Results 1 to 10 of 10

Thread: How do you change mouseover to onclick?

  1. #1
    Join Date
    Dec 2008
    Posts
    20
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question How do you change mouseover to onclick?

    1) Script Title: All Levels Navigational Menu (v1.5)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/

    3) Describe problem:
    Can anyone tell me how I can change the mouse over event to an onclick event with the top level menu? I am experimenting with using a button (with mouseover effects) for the user to click on the button to open the menu "onclicK".
    If you can give me any tips on how to replace the background text link panel with an image of a button as well, then that would be great.

    I've so far tried searching the forums but cannot seem to come up with an answer.
    Thanks.

    !!* If anyone else is interested in changing the script for clicking the menu instead of mouseover (This is not including any mods to have an image instead of the normal menu.)
    I have uploaded a new script (provided by DDAdmin) for this to work correctly.
    Last edited by maximumovertime; 12-22-2008 at 03:10 AM. Reason: New information.

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Replace your JavaScript file with this one:
    Attachment 2320

    You also have to make sure that the buttons with submenus do not link to another page.

    I'm afraid I don't understand what your second request is.
    Eddy Proca
    I love Dropbox. Get it through my girlfriend's referral link (I reached my limit) and both you and her get 500 MB extra! Thanks and you're welcome!

  3. The Following User Says Thank You to Snookerman For This Useful Post:

    maximumovertime (12-14-2008)

  4. #3
    Join Date
    Dec 2008
    Posts
    20
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Thanks works better but with some problems...

    Thanks Snookerman,
    I uploaded the version you gave me and the to see that it works gave me great joy, however, there is only one problem and that is when I click on the image of the button; the menu opens but closes straight away again!
    Just wondering if you know what might be causing this?
    Don't worry about the second part of my original question as I found a way to set the image of the button in place of the original 'interface' that the script produces on the page.
    I really appreciate your help with this script - I didn't think I was going to have much luck other than a difficult road of trying to study up on Javascript coding.
    Again, if you can help me with an answer to the menu not staying open, then that would be great.
    I also just noticed that there are some other problems with the menu not opening properly at all - ( a rectangular vertical section opens up uncovering only part of the submenus ). I'm not sure if this is because of the way I have attached the image of the button?
    The URL is: (no longer here as the page is no longer active) if you want to check the source code to see what I might be doing wrong.
    Thanks.
    Last edited by maximumovertime; 12-22-2008 at 03:46 AM. Reason: Removing link

  5. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    For the links that you click change this href="" to this href="#".
    Eddy Proca
    I love Dropbox. Get it through my girlfriend's referral link (I reached my limit) and both you and her get 500 MB extra! Thanks and you're welcome!

  6. #5
    Join Date
    Dec 2008
    Posts
    20
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re;Thanks works better but with some problems...

    Thanks again for your help Snookerman, I did what you said and it resolved the problem but only partially.
    The problem seems to be with the image itself. The text links work to expand the vertical menu and keep it open, however when I click on the image of the button, the menu expands but will stay open only sometimes.
    The problem seems intermittent and will not work most times that I test the button.
    As soon as the left mouse click is released the menu will still close.

    I tried removing the mouse rollover effect from the button image, thinking that maybe there was interference with the java script but it still made no difference to the problem.

    I was wondering if there may be some kind of adjustment that can be made to the 'ddlevelsmenu' file in order to solve the problem with using this (interactive) image?

    I'm sorry to take your time with this but really do appreciate the help that you have already given to me and any help that you may still be able to give in this matter.

    Thanks again.

  7. #6
    Join Date
    Dec 2008
    Posts
    20
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Talking Problem solved

    Thanks for everything,
    I spied a hidden line of text in the java script file that read:

    //hide drop down ul if mouse moves out of menu bar item but not into drop down ul itself
    This gave me a clue about the width of the sidebar menu.

    Solution: Edit the line of code in the ddlevelsmenu-sidebar stylesheet:

    .markermenu{
    width: 210px; /*width of side bar menu*/
    to the width of my (button) image

    Problem solved!!

  8. #7
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    You're welcome and I'm glad it worked out for you. Remember to go to your first post in this thread, edit, go advanced and add the Resolved prefix to the thread title.
    Eddy Proca
    I love Dropbox. Get it through my girlfriend's referral link (I reached my limit) and both you and her get 500 MB extra! Thanks and you're welcome!

  9. #8
    Join Date
    Jan 2011
    Posts
    7
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default

    Sorry to drag up old post - but I also need this - mobile phone browsers (Android at least) do not trigger the mouseover event, so cannot use the menus. The patched V1.5 seems to work fine, but is there any benefit in applying the fix to V2.2 - or is it possible to make onclick configurable, or perhaps even in addition to mouseover?

  10. #9
    Join Date
    Jan 2011
    Location
    Probstdorf, Austria
    Posts
    9
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default

    I am using v2.2 of the All Levels Navigational Menu on a website, but I have this issue that when users "click" on the main menu bar the drop-down sub menu closes. This behaviour upsets the users as they would expect either a page to open (which I do not offer as they are all set href="#"), or the drop-down sub menu to at least stay open.

    I have looked at the code in ddlevelsmenu.js but it is quite complex and would like some expert advice on what to change. I would like the drop-down to appear "onclick" in addition to "mouseover" for the main menu (top bar) items.

  11. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Please start a new thread for a new question.
    - John
    ________________________

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

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
  •