Toggle Visibility

Fading objects out of the document is very common with modern user interfaces. You can always have small popup boxes or notifications which need to display and then hide after a few seconds. Using the fadeToggle function you can quickly hide and display any objects in your DOM. Keep this code handy if you will […]

Read More

Toggle CSS Classes

Adding and removing CSS classes on HTML elements is another fairly common action. This is one technique you may consider with selected menu items, highlighted rows, or active input elements. This newer method is simply quicker than using .addClass() and .removeClass() where you can put all the code into one function call. $(‘nav a’).toggleClass(‘selected’);

Read More

Toggle, Show, and Hide Functions

// toggle hide/show of an element $(“#DivID”).toggle(1000); // do something when animation is complete $(“#DivID”).toggle(1000, function () { alert(“Toggle Complete”); }); // hide an element $(“#DivID”).hide(1000); // do something when animation is complete $(“#DivID”).hide(1000, function () { alert(“Hide Complete”); }); // show an element $(“#DivID”).show(1000); // do something when animation is complete $(“#DivID”).show(1000, function () […]

Read More