Welcome to TalkGraphics.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2005
    Posts
    11

    Default

    I have worked out a script that makes the menu stay at the top of the browser no matter where the reader scrolls. Effectivly simulating a toolbar.

    This works well but has one limitation.
    If the user clicks the "tool bar" to an external link then obviuosly the bar dissapears. Essentially its a toolbar just for my site.

    I would love to see MM have the ability to cross over frames so as to simulate a toolbar better and stay in view even when the user went to another site. Could this be done?

  2. #2
    Join Date
    Jul 2005
    Posts
    11

    Default

    Here is the script if anyone is interested.
    Just rename the "test.js" in the script to the name of your generated script.

    <pre class="ip-ubbcode-code-pre"> <script>
    if (!document.layers)
    document.write('<div id="divStayTopLeft" style="position:absolute">')
    </script>

    <layer id="divStayTopLeft">

    <script src="xaramenu.js"></script><script menumaker src="test.js"></script>

    </layer>


    <script type="text/javascript">

    /*
    Floating Menu script- Roy Whittle (http://www.javascript-fx.com/)
    Script featured on/available at http://www.dynamicdrive.com/
    This notice must stay intact for use
    */

    //Enter "frombottom" or "fromtop"
    var verticalpos="fromtop"

    if (!document.layers)
    document.write('</div>')

    function JSFX_FloatTopDiv()
    {
    var startX = 3,
    startY = 0;
    var ns = (navigator.appName.indexOf("Netscape") != -1);
    var d = document;
    function ml(id)
    {
    var el=d.getElementById?d.getElementById(id):d.all?d.a ll[id]:d.layers[id];
    if(d.layers)el.style=el;
    el.sP=function(x,y){this.style.left=x;this.style.t op=y;};
    el.x = startX;
    if (verticalpos=="fromtop")
    el.y = startY;
    else{
    el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
    el.y -= startY;
    }
    return el;
    }
    window.stayTopLeft=function()
    {
    if (verticalpos=="fromtop"){
    var pY = ns ? pageYOffset : document.body.scrollTop;
    ftlObj.y += (pY + startY - ftlObj.y)/1;
    }
    else{
    var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
    ftlObj.y += (pY - startY - ftlObj.y)/1;
    }
    ftlObj.sP(ftlObj.x, ftlObj.y);
    setTimeout("stayTopLeft()", 1);
    }
    ftlObj = ml("divStayTopLeft");
    stayTopLeft();
    }
    JSFX_FloatTopDiv();
    </script>
    </pre>

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •