javascript - How to animate the width of a div slowly with jquery -
i have navigation nested in div offscreen left , when user scrolls down page , reaches pixel 296, left navigation appears it's width growing towards right.
what have half working. navigation nested in div appears when user scrolls down page want animate right , not happening. not sure doing wrong. specific line having problems is:
$("#slidebottom").animate({ width: "100" }, 'slow');
but here entire code:
$(window).scroll(function(){ var wintop = $(window).scrolltop(), docheight = $(document).height(), winheight = $(window).height(); var bottomheight = $("#slidebottom").height(); var zeroheight = 0; if (wintop > 296) { bottomheight = $('#slidebottom').height(docheight); $("#slidebottom").animate({ width: "100" }, 'slow'); } if( wintop < 296) { bottomheight = $('#slidebottom').height(zeroheight); //$("#slidebottom").animate({ width: "0" }, 'slow'); } });
the jquery docs show ints, not strings, arguments width:
$("#slidebottom").animate({ width: 100 }, 'slow');
edit: wrong, that's not problem; handles strings well.
Comments
Post a Comment