I have a hidden section at the top of my website that expands upon clicking. The slideToggle animation works well, but I want the div to cover the entire window height.
While I've managed to set the window's height as a variable and adjusted the CSS accordingly, combining it with slideToggle results in a jittery animation.
jQuery(document).ready(function($) {
var win = $(window).height();
$("#hidden").css("min-height", win);
$("a#toggle").click(function() {
var txt = $("#hidden").is(':visible') ? 'Show' : 'Hide';
$("#toggle").text(txt);
$("#hidden").slideToggle(500);
});
});
You can view a demonstration on this fiddle here.
If you remove the first two lines of the jQuery code, the sliding behavior is normal.
Thank you for your assistance!