-
-
Save daifu/3067512 to your computer and use it in GitHub Desktop.
Create, show, and hide grid toggle with jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
// Create, show, and hide grid toggle | |
$('body').append('<div id="grid"></div>'); | |
$('body').append('<a href="#" class="toggle-grid"><span class="show">Show Grid</span><span class="hide">Hide Grid</span></a>'); | |
$('a.toggle-grid').toggle(function() { | |
$('#grid').slideDown('fast'); | |
$('.toggle-grid .hide').show(); | |
$('.toggle-grid .show').hide(); | |
}, function() { | |
$('#grid').slideUp('slow'); | |
$('.toggle-grid .hide').hide(); | |
$('.toggle-grid .show').show(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment