Results 1 to 3 of 3

Thread: Omnislide Onclick Events for Sliding In and Out?

  1. #1
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Omnislide Onclick Events for Sliding In and Out?

    Script Title: Omni Slide Menu

    Script URL (on DD): http://www.dynamicdrive.com/dynamici...lide/index.htm

    Hi,

    First of all, great script! I am trying to get Omnislide to slide in and out with onclick events instead of mouseover & mouseout events. I found some code on the Dynamic-FX menu that jscheuer1 posted in order to make it possible with that menu:

    var dFlag=0
    function moveMenu(){
    if (dFlag==0){
    dFlag=1;
    moveOut()
    }
    else{
    dFlag=0;
    moveBack()
    }
    }

    function buildMenu() {
    if (IE||NS6) {document.write('<DIV ID="basessm" style="visibility:hidden;Position : Absolute ;Left : '+XOffset+'px ;Top : '+YOffset+'px ;Z-Index : 20;width:'+(menuWidth+barWidth+10)+'px"><DIV ID="thessm" style="Position : Absolute ;Left : '+(-menuWidth)+'px ;Top : 0 ;Z-Index : 20;" onclick="moveMenu()" onclick="moveMenu()">')}
    The above code worked great in the Dynamic-FX menu. It only opens and closes when it is clicked. I tried something similar to this code in the Omnislide's mmenu.js file around Line 278 where it has the following:

    var tb='<div id="'+o.id+'" onmouseover="movein(this);" onmouseout="moveout(this);"><div><table>\n';
    tb+=o.menupos=='right'? make_bar(o) : '';

    It seems like I get ONE onclick event (i.e. onclick="movein(this)) to work which slides the menu out, but the second onclick event doesn't trigger and the menu is "stuck" open. Even when I create a function with if statements like the Dynamic-Fx example above. Thanks so much in advance for your help!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,069
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    You would have to do a similar thing to what was done with the other code. That is add a function:

    Code:
    function MoveMenu(obj){
    if(!obj.dFlag){
    movein(obj);
    obj.dFlag=1;
    }
    else {
    moveout(obj);
    obj.dFlag=0;
    }
    }
    Then you could change it to:

    Code:
    var tb='<div id="'+o.id+'" onclick="MoveMenu(this);"><div><table>\n';
    tb+=o.menupos=='right'? make_bar(o) : '';
    Untested.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking Thanks!

    John,

    I racked my brain all lastnite trying to get this to work when I probably should have written you sooner! I guess I try so hard to figure things out first, before bugging anyone else. Anyway, works like a charm now! I can't thank you enough. I've read many of your posts on here and you are like a javascript God in my book! Thanks again!

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
  •