ALL


  JavaScript to scroll element into view

In AJAX applications, there are frequent needs to scroll some element into view after some modification to the page. For example, after adding an item or updating an element in an admin panel, the page may need to be scrolled to the item added or updated so that we can see the changes immediately.In these cases, JavaScript can be used to scroll the element we want to show. In Vanilla JavaScript, there is no built-in function which can achieve scroll_element_into_view(), but most of modern browsers provide function like window.scrollTo() which can scroll the page to some position. window.s...

16,616 0       JAVASCRIPT JQUERY SCROLLTO HOW-TO


  jQuery to check whether checkbox is checked

In Vanilla JavaScript, the correct way of checking whether a checkbox is checked is to get the property checked of the checkbox. Assuming there is an checkbox with id "checkbox1", below line will return true if the checkbox is checked while it will return false if the checkbox is unchecked:document.getElementById("checkbox1").checkedIn jQuery, there are a few ways to check this. The first one is to using the corresponding counterpart of the Vanilla JavaScript, it is to check the checked property.$("#checkbox1").prop("checked")The prop() method will get the value of a property for the firs...

15,564 1       JQUERY CHECKBOX CHECKED ATTR PROP


  20 cool jQuery countdown scripts and plugins

Have you ever seen the count down component of Apple before its app downloads reached 50 billion times? It's really cool. On a website, we often need to have a count down function, for example, when a e-commerce site initiates some promotions or some organizations want to start an event. In this post, we introduce some cool jQuery countdown scripts and plugins.Circular Countdown jQuery Plugin MORE INFO / DEMOCoconut – Jquery Countdown Plugin - MORE INFO / DEMOIt contains 4 circles with different sizesDynamic Countdown with Counter – MORE INFO /&nb...

15,732 0       JQUERY PLUGIN COUNTDOWN


  No support of $.browser in jQuery 1.9

Starting from jQuery 1.9, $.browser is no longer supported to detect the nrpwser type and version. The substitute is $.support. In the newer jQuery 2.x versions, IE 6/7/8 are also not supported. If users want to support IE 6/7/8, they must use jQuery 1.9. If you want to fully support IE and want to use jQuery 1.9 and jQuery 2.0, the official solution is:<!--[if lt IE 9]> <script src='jquery-1.9.0.js'></script><![endif]--><!--[if gte IE 9]> <script src='jquery-2.0.0.js'></script><![endif]-->For the long run, this can help in browser feature ...

5,192 0       JQUERY $.BROWSER $.BROWSER.VERSION


  9 useful jQuery code snippets

jQuery is one of the most popular JS library among front end developers because of its functionality and usability. Here we share with you some useful jQuery code snippets which can be used in our daily front end development.1. Smoothly return to page top$(document).ready(function() { $("a.topLink").click(function() { $("html, body").animate({ scrollTop: $($(this).attr("href")).offset().top + "px" }, { duration: 500, easing: "swing" }); return false; });});2. Modify image size$(window).bind("load", function() { // Modify i...

3,354 0       JQUERY CODE SNIPPET


  How to be jQuery-free?

jQuery is now the most famous JavaScript library. There are around 57.3% websites in the world using jQuery, i.e, 6 out of 10 websites are using jQuery. If we only consider those websites which use libraries, then the percentage is even higher which is 91.7%.Although jQuery is very popular, its size is still a headache to many websites maintainers. The uncompressed jQuery 2.0 has a size of 235KB, the size is 81KB after optimization.The jQuery 1.8.3 which supports IE 6/7/8 has a uncompressed size of 261KB, the size is 91KB after optimization.It takes around 1 second to load this file, it may ta...

6,882 0       JAVASCRIPT JQUERY CSS3 ECMASCRIPT


  noConflict mechanism in jQuery

Many JavaScript frameworks like to use $ as function or variable name, jQuery is one of them. In jQuery, $ is just a reference to window.jQuery, so even if $ is deleted, window.jQuery will still be available to ensure the whole library can work normally. jQuery API design takes fully consideration of multiple frameworks conflicts, we can use jQuery.noConflict function to easily handle control.jQuery.noConflict accepts one optional boolean parameter[1] to determine whether to hand jQuery object itself when handing the $ reference.jQuery.noConflict([removeAll])By default, when executing noConfli...

4,407 0       JQUERY NOCONFLICT $


  How to choose a jQuery plug-in?

jQuery plug-in provides a good way to save time and simplify the development, programmers don't need to write each component from scratch. However, the plug-in will also be a destabilizing factor in your code library. A plug-in saves countless development time, but a poor quality plug-in will cost more than the actual time to write your own component from scratch.Luckily, usually you have many pls to choose from, but even if you have only one plug-in, you also need to know whether it's worth using or not, don't ever introduce wrong codes into your code library.Do you need a plug-in?First you n...

3,624 0       JQUERY PLUG-IN