Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery scrollTop does not work in IE8
    text
    copied!<p>I'm trying to scroll the page based on the hash on the url. Here's my code:</p> <pre><code>var hash = window.location.hash; $(hash).scrollTop(); </code></pre> <p>This doesn't to anything. So what am I doing wrong? And another thing, I need something like this:</p> <pre><code>$(hash).scrollTop($("#header").height()); </code></pre> <p>Is that possible?..is my div(the element hash is pointed to) going to scroll to the top, upto the bottom of the <code>"#header"</code>?..</p> <h1>Update 1</h1> <p>The hash text is an id so it returns the text "#myid" from <code>window.location.hash</code>. One other thing, the div of the header has a <code>position:fixed</code> on its css while the container where the div(the hash is id'd to) has a <code>position:absolute</code> so it is scrolling under the <code>#header</code> that's why I need it to scroll to the bottom of the header or the height.</p> <h1>Update 2</h1> <p>I'm now trying to use the <a href="https://github.com/Arwid/jQuery.scrollIntoView" rel="nofollow">scrollIntoView() plugin</a> but having the error. </p> <pre><code>Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E) Timestamp: Mon, 17 Oct 2011 03:23:18 UTC Message: Object doesn't support this property or method Line: 71 Char: 5 Code: 0 URI: http://localhost:3000/javascripts/jquery.scrollIntoView.js Message: Object doesn't support this property or method Line: 34 Char: 5 Code: 0 URI: http://localhost:3000/surveys/%E6%83%85%E5%A0%B1%E3%82%BB%E3%82%AD%E3%83%A5%E3%83%AA%E3%83%86%E3%82%A3%E3%83%BB%E5%80%8B%E4%BA%BA%E6%83%85%E5%A0%B1%E4%BF%9D%E8%AD%B7%E3%83%81%E3%82%A7%E3%83%83%E3%82%AF%E3%82%B7%E3%83%BC%E3%83%88%EF%BC%88%E8%87%AA%E5%B7%B1%E7%82%B9%E6%A4%9C%EF%BC%89-%E7%89%88-1-0/C9uKCqXNn2/take?section=17 </code></pre> <p>My code is: <code>$("#survey_section_8").scrollIntoView();</code></p> <p>what am I doing wrong here?..</p> <p>Hope that I was clear in my questions. Thank you!</p>
 

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