Note that there are some explanatory texts on larger screens.

plurals
  1. POMake div scroll until it reaches top of page?
    primarykey
    data
    text
    <p>I am trying to use the following example in wordpress - I need a div that holds an advert to start, say, 300px down the page, then scroll up witht he page until it reaches the top, then stay there if the user continues to scroll down. The example should explain this:</p> <p><a href="http://jsfiddle.net/jPxEY/" rel="nofollow">http://jsfiddle.net/jPxEY/</a></p> <p>here it is in an html file that should work, everything seems there, but it will not work: <a href="http://www.altesc.net/exmp.html" rel="nofollow">http://www.altesc.net/exmp.html</a></p> <p>In fact, if you look tot he right at the "Similar Questions" box and scroll down, it's exactly what i'm after.</p> <p>I am pretty sure I've done everything correctly, but the javascript doesn't seem to work. If i copy everything from jquery and just add it directly to the header, and not in a separate js file, it works, it's only when i call jquery like this:</p> <pre><code>&lt;script src="http://code.jquery.com/jquery-1.7.1.js" type="text/javascript"&gt; </code></pre> <p>it fails to kick in.</p> <p>Any ideas as to what is wrong?</p> <p>Added my header to help:</p> <pre><code>&lt;script type='text/javascript' src='http://www.altesc.net/wp-includes/js/jquery/jquery.js?ver=1.8.3'&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; //&lt;![CDATA[ $(window).load(function(){ $(document).scroll(function() { var useFixedSidebar = $(document).scrollTop() &gt; 330; $('.adscrollleft').toggleClass('fixedSidebar', useFixedSidebar); }); });//]]&gt; &lt;/script&gt; </code></pre>
    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.
    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