Thursday, April 30, 2015

Creating a Web App From Scratch Using AngularJS and Firebase: Part 6

How to Set Up a Facebook Page for Business

Are you interested in setting up a Facebook page for your business? Not sure where to start? Maybe you’ve thought about it but didn’t get past choosing a category or creating a cover photo. If you’re considering setting up a Facebook page, or have started the process but never finished, this article is for you. […]

This post How to Set Up a Facebook Page for Business first appeared on Social Media Examiner.
Social Media Examiner - Your Guide to the Social Media Jungle


by Kristi Hines via Social Media Examiner

ANA Flight Connections

ANA Flight Connections helps LinkedIn users turn their online connections into in-person meetings. The platform visualizes a user’s LinkedIn network by overlaying their connections and ANA flight routes on a Web GL powered globe.
by via Awwwards - Sites of the day

Don’t Load it till it’s Needed

The average web page has nearly doubled in size since 2010. While this might not come as a surprise to any of us, there is certainly plenty that we can do to scale back the weight of our web pages.

One of my favourite ways to prevent page bloat is to treat everything as a resource that doesn’t need to be on the page until the user has to interact with it. The technique is called lazy-loading, and can be performed on almost any asset. It’s especially good for responsive websites, when the same content needs to be loaded across multiple devices, while still loading as quickly as possible. Let’s take a look at a few ways to make this possible.


Images, Video, and Audio

The key to lazy-loading these assets is to leave the html structure in tact, while deferring their src attributes until absolutely necessary.

Images

Let’s take a regular image that hasn’t been adjusted for lazy-loading.

<img src="myimg.png" alt="a picture of bacon or something">

In order to lazy-load this image, the first thing we need to do is address the src attribute, so that the DOM won’t grab the asset immediately. To do that, we’ll change the src attribute into a data attribute. <img data-src="myimg.png" alt="a picture of bacon or something">. If we need to lazy-load a responsive image, our snippet will end up looking something like this: <img data-src="myimg.png" dta-srcset="img1.png 320w, img2.png 640w, img3.png 1280w" data-sizes="(min-width: 33em) 75vw, 100vw" alt="a picture of bacon or something">. One thing to note is that while the sizes attribute is not responsible for loading images, it still needs to be lazy-loaded with the src and srcset attributes. This is because if the sizes attribute is present before any of the image assets, the browser will not load the correct image. A side effect of using this technique is that images won’t initially have a width or height, unless they are set beforehand using css or width and height attributes in the HTML.

Videos

Lazy-loading video assets can be a little bit tricky. While my initial approach was to do something like this – <video data-src="videofile.mp4"</video> – I found that when the src attribute is added, the video won’t function correctly in all browsers. In order to fix this, a slightly more difficult solution is needed. What does end up working is adding <source> tags in between the opening <video> tags as soon as the video is needed.

Audio

Lazy-loading an audio resource is much more like an image, in that all that is needed is to change a data attribute into a source attribute when the resource is needed. Don’t forget to ensure that the controls attribute is present in the audio tag, or else nothing will show up when the tag is present on the page. Here is an example.


Third Party Resources

Every now and then a third party widget needs to be present on a page. These can be things like photo galleries, social networking feeds, comment systems, and ads. Resources like these can often add to initial page load time, with extra requests and heavy files needed to render the widget. In order to prevent widgets from slowing down the site, we’ll want to lazy-load them in whenever possible. This usually means wrapping the entire widget inside of a script tag, and dropping its contents inside of an empty container just before the asset is needed.


Tying it all together

Now that we’ve gone over a few use cases for lazy-loading, let’s take a look at how we can use javascript to tell us when an element needs to be ready and visible to the user.

To do this we’ll be using the getBoundingClientRect() method, which will return an elements size and position relative to the viewport. We’ll attach this to a scroll event listener so that when the user is scrolling we can fire an event to tell us that the element is visible in the viewport. It’s important to remember not to run too many calculations inside of a scroll event listener, since this will lead to performance bottlenecks.

For this demonstration, we’ll be loading an image when it is visible in the users viewport.

See the Pen Lazy-loading an image by Tim (@tevko) on CodePen.

The PolyFill is being included in order to provide support for custom events in IE. We’re also using requestAnimationFrame() which will help to keep a high frame rate while we scroll, allowing for a smooth scrolling experience.

Once the custom event has fired, the notCalled variable is set to false, preventing the checkViewport function from being called needlessly.


Conclusion

While you now have a few techniques aimed at making your websites lighter, faster, and all around easier to use, remember that performance is a constant battle, and there are several other ways to make your site perform better for all devices.


Resources
CustomEvent API
requestAnimationFrame API

The post Don’t Load it till it’s Needed appeared first on Web Design Weekly.


by Tim Evko via Web Design Weekly

YSDN Made Grad Show

The York University/Sheridan College Honors Bachelor of Design Program presents YSDN MADE


by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery

Wednesday, April 29, 2015

Pogo Slider : jQuery Animated Slider Plugin

Pogo Slider is a jQuery plugin that allows you to create animated image/content sliders. CSS animations are used to transition between slides. A CSS animation can be triggered on element within a slide, after the slide transitions in, and as the slide transitions out.

The post Pogo Slider : jQuery Animated Slider Plugin appeared first on jQuery Rain.


by Admin via jQuery Rain

Material Design Stopwatch, Alarm and Timer with jQuery

We have something special for all of our readers today. We made a small JavaScript application that conforms to Google’s Material Design Guidelines. It consists of three parts – an alarm clock, a stopwatch and a timer. The application is responsive and has a bunch of subtle animations that react to user input.

We use the modern Materialize framework, together with jQuery, jQuery Timepicker and Hammer.js for touch events. Materialize turns the plain looking standard HTML input fields into these awesome Android-like switches and check boxes. It also adds the the on-click wave ink effect as it has Waves.js included in it’s package.

The post Material Design Stopwatch, Alarm and Timer with jQuery appeared first on jQuery Rain.


by Admin via jQuery Rain