Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with jQuery Horizontal srolling
    primarykey
    data
    text
    <p>This is my css</p> <pre><code> &lt;style type="text/css" media="screen"&gt; body { margin: 0; } #wrap1{ width:600px; margin:0 auto; overflow:hidden; -moz-box-shadow: 0 0 2px 2px #ccc; -webkit-box-shadow: 0 0 2px 2px #ccc; box-shadow: 0 0 2px 2px #ccc; } #body1{ width: 8000px; } .panel { width: 600px; float: left; left:0px; top:0px; margin-top: 45px; background: #eee; } #banner { position: fixed; } #banner ul { line-height: 45px; margin: 0 30px; padding: 0; } #banner ul li { display: inline; margin-right: 30px; } &lt;/style&gt; </code></pre> <p>This is what I have in my body</p> <pre><code> &lt;div id="wrap1"&gt; &lt;div id="body1"&gt; &lt;div id="banner"&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="#home"&gt;Home&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#newsletter"&gt;Newsletter&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#directions"&gt;Directions &amp;amp; Opening Hours&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#contact"&gt;Contact us&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id="home" class="panel"&gt; &lt;h2&gt; Home &lt;/h2&gt; &lt;p&gt; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. &lt;/p&gt; &lt;/div&gt; &lt;div id="newsletter" class="panel"&gt; &lt;h2&gt; Newsletter &lt;/h2&gt; &lt;p&gt; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. &lt;/p&gt; &lt;/div&gt; &lt;div id="directions" class="panel"&gt; &lt;h2&gt; Directions &lt;/h2&gt; &lt;p&gt; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. &lt;/p&gt; &lt;/div&gt; &lt;div id="contact" class="panel"&gt; &lt;h2&gt; Contact &lt;/h2&gt; &lt;p&gt; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>and this is the javascript</p> <pre><code> &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" charset="utf-8"&gt; $(document).ready(function() { $("#banner a").bind("click",function(event){ event.preventDefault(); var target = $($(this).attr("href")); $("html, #wrap1").stop().animate({ scrollLeft: $(target).offset().left, scrollTop: $(target).offset().top }, 1200); }); }); &lt;/script&gt; </code></pre> <p>I want to have something like this. So, when I clicked the navigation contact, the page inside the wrap1 will scroll smoothly to the where the anchor #contact is</p> <p><br></p> <p>However, what i get right now is the smooth scroll is working fine, however, it doesn't seem stop at where it is supposed to stop. For instance, when I click Newsletter link, the scroll will stop in the half part of Newsletter. So when click Newsletter link, it will show me half part of Newsletter and half part of Directions.</p> <p>Please jQuery guru out there help me fix this issue. This has been bugging me for days.</p> <p>Thanks and sorry for the lack of jQuery knowledge I have.</p> <p>*EDITED: This is my page looks like right now. Please help <a href="http://testhscroll.tumblr.com/" rel="nofollow">http://testhscroll.tumblr.com/</a></p>
    singulars
    1. This table or related slice is empty.
    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.
    1. This table or related slice is empty.
    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