Top 8 jQuery Tips and Tricks

Here are some cool tips and tricks for jQuery. There are a lot of things that can be done with this wise javascript library like resizing of fonts, disabling right clicks and more. You can also do custom coding of jQuery and do amazing scripts just like this list that I have.

1. FONT RESIZING

This will allow users to increase or decrease the font size from web page. You must specify what ID or CLASSES of HTML elements that you want the font to be adjustable.

2. BACK TO TOP BUTTON OR LINK

This is a very nice way of going back to the top of the page by using jQuery scrolling effects on links or button.

THE CODE:

$('#top').click(function() {
$(document).scrollTo(0,500);
}
Back to top

3. DETECT RIGHT CLICK

It’s important to consider doing right clicks on a website. Because sometimes we might want to disable a right click function on a website. So here’s how we’re going to detect the right click of a mouse using jQuery.

4. OPENING IN A NEW WINDOW

As you might know, Target attribute of ‘a’ tag in html doesn’t pass the W3C validation so you will get some validation errors here. What this jQuery code will do is to replace Target attribute by something that can pass W3C validation. So here goes REL and some jQuery codes.

7. MAKE WHOLE LI CLICKABLE

A very useful trick when you’re using UL list to make a navigational menu. When you click on the LI area (outside of the link) it will amazingly search for the url in the anchor tag and then execute it.