JQuery show hidden content, then auto scroll to the middle of the content?

JQuery('. Open-content'). SlideToggle(1000, function(){ var offset = jQuery('.

Open-content').offset(); var y = offset. Top + jQuery('. Open-content').height(); var wheight = $(window).height() var scroll = y - wheight; $(document).

Animate({scrollTop:scroll}, 500); }).

Fantastic! This is very close; the only issue I am having with the above is that upon click it shoots me to the top of the page before scrolling down to the new expanded page area. How can I prevent it from linking to the top before it scrolls down to view the expanded area?

Maybe it is that I have implemented it incorrectly: gist.github. Com/1129878 – SullX Aug 6 at 23:25 I am also noticing that if I zoom completely out so the current position of page is equivalent to the top of the page, clicking the expand button shifts the entire page to the left by about ten pixels. Makes the effect look a little jerky.

– SullX Aug 6 at 23:36 I change the selector to document (should work better now). Also, I recommend you use the scrollTo plugin, code will be something like this: $(document). ScrollTo({top: scroll}, 'medium'); – CookieMonster Aug 7 at 11:47 1 Great tip.

The issue of it linking to the top was a rogue href="#" x-D. Fantastic help, CM; thanks! – SullX Aug 8 at 2:47 Ok, glad to have helped!

– CookieMonster Aug 8 at 15:47.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions