javascript - Scroll to Top does not work after hiding elements (jQuery) -
currently have function menu scrolls different divs on page, form of navigation. i'm using next method.
scroll portfolio
$("html, body").animate({ scrolltop: $('#portfolio').offset().top }, 600);
since i'm building entire page dynamically, when clicks on link, using .hide() hide main page elements, , generating additional content.
function hideelements() { $("#something").hide(); }
while on content page, if want go portfolio, click on portfolio link again. i'm using next method "scroll" them re-shown element.
$("#nav").click(){ unhidemainelements(); $("html, body").animate({ scrolltop: $('#portfolio').offset().top }, 1200); $("#container").fadein(300); }
the problem is, fade work, won't scroll element. i'd figure has .hide() element , .show() element, don't know why. appreciate insight. thanks!
you might seek visibility
proprety instead of display
:
$('#something').css({'visibility':'hidden'}); //or visible
the element should maintain native dimensions without been showed.
javascript jquery html css animation
No comments:
Post a Comment