javascript - ScrollTo() function is not working properly with sections -


I have a series of sections on such an app, which I have just finished developing. I'm using the scrollTo plugin for jQuery It always works well for me in the past.

What is considered to apply is low:

  1. All section loads and first section spreads immediately, everything else
  2. Click on the other section, and the section that is currently open will fall, and the one you click on will expand (this works)
  3. After the expansion is completed, The window will scroll to the top of the expanded section (this does not work)

There are three steps Switch to the need to help my code below

I have discovered various disciplines on the use of the scrollTo () plugin and ScrollTop is I've tried both, but nothing has changed.

I am thinking that when the toggle function is called, there is something to do with it, but I am not sure.

I'm really hoping to find an answer. You need more clarification or code, please tell me!

  // module expansion and contraction $ ('.module-title'). Click (function () {var id = $ (this) .attr ('id'); var data = $ (this) .data ('toggle'); $ ('.app-section'). (): {If ($ (this) .is (':' visible '')) {$ (this) toggle ('slow');}}) $ (data) .toggle ('slow', function () { $ (Id) .scrollTo (100);});});  

There is also sample HTML

   & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; Lieutenant; Span ID = 'questionnaire' & gt; & Lt ;! - Form goes here - & gt; & Lt; / Span & gt;  

Here's a link to Bella

It looks like you We want to target the body in the new section, so we need to target html / body to do this:

  $ ('.module-heading'). (Function () {var $ this = $ ('.op-section: visible'). ("Slow"); $ ($ this.data ('toggle')) Show ('slow', function () {$ ("Html, body"). Animate ({scrollTop: $ this.offset (top.up}};});});  

Note: body To scroll, you will need overflow content to consider adding some padding to your body.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Algorithm negotiation fail SSH in Jenkins -

java - Messages from .properties file do not display UTF-8 characters -