Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery scroll not positioning well
    primarykey
    data
    text
    <p>I´m trying to make a scrolling effect on the page, the scroll makes a smooth effect but it miss the real position of the items, and start to bug after a few position clicks.</p> <p>For example if you click on the last item it goes there, but after that if you click on the third the scroll goes to top (?). so I think i´m missing something here. <strong>anybody knows how to correct the problem?</strong></p> <p>this is my markup:</p> <pre><code> &lt;div id="sidebar" class="clearfix"&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="#one" class="scroll"&gt;Muscles - Girls Crazy Go!&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#two" class="scroll"&gt;Tokyo Youth sports&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#three" class="scroll"&gt;Harajuku Interviews&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#four" class="scroll"&gt;Tokyo Youth&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Div to scroll example:</p> <pre><code> &lt;div class="cinematography_box clearfix" id="two"&gt; &lt;div class="cinematography_item"&gt; &lt;img src="img/cinematography.jpg" alt="cinematography" width="700" height="397"&gt; &lt;/div&gt; &lt;div class="cinematography_info"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>and my script:</p> <pre><code> jQuery(document).ready(function($) { $(".scroll").click(function(event){ event.preventDefault(); $('#main').animate({scrollTop:$(this.hash).offset().top}, 500); }); }); </code></pre> <p>I´m trying to do this without a plugin so if there is a solution with this code it would be better!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload