All Levels

Snippets: Disable Scroll Using jQuery

Most developers probably wouldn't want to disable scroll on their pages, but of course, there are always exceptions to any rule, and there are a number of reasons that scroll may need to be disabled. It could be for design or functionality reasons, or it could just be the result of a click event or […]
Read the rest of this entry »

jQuery: Enable Click Event for Some Anchor Elements

jQuery provides a very easy way to disable click events for any DOM element. And you can also disable click event for all Dom elements with few lines of code. But then what if you want to enable click event for some elements? For example, if a click event is disabled for all anchor elements, […]
Read the rest of this entry »

jQuery’s .attr() Method

In jQuery, the attribute or .attr() method is used to set the attributes values of selected elements. It works similarly to the .css() method, except with .attr(), you're not setting or changing the style rules, but the inline HTML attributes of a particular element. Common HTML attributes that can be altered are width and height, […]
Read the rest of this entry »

jQuery: Showing/Hiding HTML Elements Based on Scroll Position

Showing/hiding any HTML DOM element is a common scenario based on various business requirements. Since the time of SPA (single page application) is evolved, you will find that on scroll position of browser, new elements are shown and previous elements are hidden. There are tons of jQuery plugins available which can show/hide any HTML element […]
Read the rest of this entry »

Using Method Chaining in jQuery

When you use method chaining in jQuery, it ensures that you never have to use the same selector more than once. Over-using a selector can seriously slow down your code, as every time you call on a selector you're forcing the browser to go looking for it. By combining or "chaining" multiple methods, you can […]
Read the rest of this entry »

jQuery Prefixes: jQuery vs. $

It's a really common practice in jQuery to use the dollar sign ($) prefix with your methods, like this: $(document).ready(function(){ $(#myDiv).slideUp(); }) The above code would make the div with the ID #myDiv slide up when the page loads. But that's not the only way to write that function. Sometimes you might see it written […]
Read the rest of this entry »

Responsive Menu
Add more content here...