Sliding divs horizontally with JQuery

Unfortunately there is no ready made ‘horizontal’ slide animation with jQuery. Unless you go with bigger packages like jQuery UI. But I don’t think that is needed. The only thing you want is some creative use of the animate() function in jQuery to achieve an effect. I didn’t know which one you’d want to go … Read more

jQuery Toggle State

You can check the state of the toggle in jQuery by using .is(“:hidden”). So in basic code what I used: $(“#div_clicked”).click(function() { if ($(“#toggle_div”).is(“:hidden”)) { // do this } else { // do that } }); # add missing closing

Click toggle with jQuery

This is easily done by flipping the current ‘checked’ state of the checkbox upon each click. Examples: $(“.offer”).on(“click”, function () { var $checkbox = $(this).find(‘:checkbox’); $checkbox.attr(‘checked’, !$checkbox.attr(‘checked’)); }); or: $(“.offer”).on(“click”, function () { var $checkbox = $(this).find(‘:checkbox’); $checkbox.attr(‘checked’, !$checkbox.is(‘:checked’)); }); or, by directly manipulating the DOM ‘checked’ property (i.e. not using attr() to fetch the … Read more

jQuery Toggle Text?

$(function() { $(“#show-background”).click(function () { $(“#content-area”).animate({opacity: ‘toggle’}, ‘slow’); }); var text = $(‘#show-background’).text(); $(‘#show-background’).text( text == “Show Background” ? “Show Text” : “Show Background”); }); Toggle hides or shows elements. You could achieve the same effect using toggle by having 2 links and toggling them when either is clicked.