Note that there are some explanatory texts on larger screens.

plurals
  1. POFloating Menu in PrototypeJS
    primarykey
    data
    text
    <p>can someone please help me make a floating menu in prototypeJS? I found documentation to do it in jQuery, like here: net.tutsplus.com/tutorials/html-css-techniques/creating-a-floating-html-menu-using-jquery-and-css/ and here: manos.malihu.gr/jquery-floating-menu, but can't figure out where to start for prototypeJS.</p> <p>So I got it work, sorta. I found <a href="http://coffeaelectronica.com/blog/2008/floating-following-div.html" rel="nofollow noreferrer">documentation here</a>. Here's my code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Prototype examples&lt;/title&gt; &lt;script src="lib/prototype/prototype.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; Event.observe(window,'scroll', function(evt){ $('movable').setStyle({ top: 8 + document.viewport.getScrollOffsets().top + 'px' }); }); &lt;/script&gt; &lt;style type="text/css"&gt; #container { background:#000; padding:100px 10px 10px; } #movable { position: absolute; float:left; width:18.5%; height: 300px; background-color: red; } #firstDiv { background:#ccc; float:right; height:1200px; width:80%; } .clear-both {clear:both;} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;div id="movable"&gt; Floating menu&lt;/div&gt; &lt;div id="firstDiv"&gt;right&lt;/div&gt; &lt;div class="clear-both"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>So now I'm trying to get it so it's not choppy when you scroll, and so the menu doesnt start moving until the scroll has moved down to like 100px vertically or something, so it hooks into place.</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.
    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