background preloader

JavaScript-2

Facebook Twitter

GitHub - im4aLL/chromeSmoothScroll: Smooth scrolling for chrome browser. Responsive Sticky Sidebar. Edit fiddle. How to detect a click outside an element? Typekit/webfontloader: Web Font Loader gives you added control when using linked fonts via @font-face. Dynamically load google fonts after page has loaded. How to Improve Page Performance with a Font Loader. A big thanks to Jason Pamental for the inspiration to write this article.

How to Improve Page Performance with a Font Loader

I’d never have considered the issue otherwise! When was the last time you used Arial, Times New Roman, Helvetica or … shudder … Comic Sans in your web pages? Web fonts took too long to arrive but, once they did, we never looked back. Fonts are fun, (often) free and fast to implement: @import url( You can then use the font throughout your pages, e.g. The fonts also work in mobile devices so users get a great experience in your Responsive Web Design. Or do they? After images, fonts are the normally the largest assets in your web page. We rarely worry about font weight problems and make excuses such as “it’s only an issue on the first page” or “many users will have the font cached”.

The JavaScript webfontloader Fortunately, there is another option: the webfontloader. To load the Ubuntu font set above, we create a global object named WebFontConfig which defines our fonts and settings then load the webfontloader itself: Loading Web Fonts with the Web Font Loader. Several years ago the consensus on font loading in the community was that, as a website loads, all fonts should be hidden until the correct resources have been downloaded.

Loading Web Fonts with the Web Font Loader

Many designers and developers argued that the default font loading method called the “Flash of Unstyled Text”, or FOUT, was an annoyance to users. This is when the fallback web font, say Georgia, is shown on screen first then replaced by a custom font when it loaded. They argued that it would make for a more cohesive browsing experience if users simply waited for everything to download instead of experiencing this flash from one typeface to another. But today this is not the case. In fact, this practice of letting a browser hide all the text that should be styled with a custom font is now called the ‘Flash of Invisible Text’, or FOIT, and is often regarded as the worst of all possible options.

Flash of Invisible Text Flash of Unstyled Text The difference between these two approaches is often startling. Variables String JavaScript ¿Mejor usar comillas simples o dobles? Secuencias escape \n \t. length (CU01114E) Resumen: Entrega nº14 del curso "Tutorial básico del programador web: JavaScript desde cero".

Variables String JavaScript ¿Mejor usar comillas simples o dobles? Secuencias escape \n \t. length (CU01114E)

Codificación aprenderaprogramar.com: CU01114E A diferencia de otros lenguajes que diferencian un tipo de dato “carácter” (char) y otro cadena de texto (string), en JavaScript existe un único tipo para englobar tanto a caracteres como a cadenas de texto como a una cadena vacía: el tipo String. Detecting a "Touch Screen" Device Using Modernizr. I’m amazed at how the mobile phone evolved over the years.

Detecting a "Touch Screen" Device Using Modernizr

Today, mobile phones are touch-enabled, can be used to surf sites like on a desktop PC, and carry a lot of handy apps to help you be more productive. When we build responsive websites that aim for mobile devices, sometimes we want to include specific and extra capabilities for users to make use of its multi-touch capability. Pin it But before that, we need to first identify if the device has support for touch interaction, and it is easy to do so with Modernizr. Check out: Getting Started with Modernizr Feature Detection with Modernizr At the Modernizr download page, ensure that the Touch Event option is selected. You can then add this Modernizr.touch in your script. It’s a basic JavaScript that will show the following popup.

Furthermore, you can also use this method to load touchSwipe, a jQuery plugin for touch gestures, conditionally. The above code will test for touch capability. Final Thought. On scroll animations using waypoints.js and animate.css - Did you ever wonder how the best themes implement on scroll animations?

On scroll animations using waypoints.js and animate.css -

This tutorial will allow you to recreate the effect using the popular jquery-waypoints plugin as well as the animate.css library. On scroll animation is a technique which has gained popularity over the past several months. It suits one-page websites as well as websites with many illustrations perfectly, giving them a more dynamic appearance. However, the animations can be applied to any element as we will soon see. For this tutorial we assume the reader has some prior experience with javascript and more specifically with the jQuery library, as we will need the aid of the popular jQuery-waypoints plugin. The following example will alert the user when he scrolls on any element that has a class ‘notify’: One can pass a second argument to the waypoint function, which is an options object.

Edit fiddle. Edit fiddle. Edit fiddle. Jquery - Animate.css + Viewport Checker delay?