Results 1 to 1 of 1

Thread: Change jqueryslidemenu From Hover To Click

  1. #1
    Join Date
    Feb 2006
    Thanked 0 Times in 0 Posts

    Default Change jqueryslidemenu From Hover To Click

    1) Script Title: jQuery Multi Level CSS Menu #2

    2) Script URL (on DD):

    3) Describe problem:

    I have been using jqueryslidemenu.js found on

    for many years now, and it's working fine until recently i discovered that the menu doesnt work on Mobile devices, I noticed i needed to change the event from mouseover to mouseclick since mobile devices don't use mouse.

    I've tried to change $curobj.hover(... to $
    but it's not working.
    Below is the content of jqueryslidemenu.js

    //Update: April 12th, 10: Fixed compat issue with jquery 1.4x
    //Specify full URL to down and right arrow images (23 is padding-right to add to top level LIs with drop downs):
    var arrowimages={down:['downarrowclass', '../resources/down.gif', 23], right:['rightarrowclass', '../resources/right.gif']}
    var jqueryslidemenu={
    animateduration: {over: 200, out: 100}, //duration of slide in/ out animation, in milliseconds
    buildmenu:function(menuid, arrowsvar){
    		var $mainmenu=$("#"+menuid+">ul")
    		var $headers=$mainmenu.find("ul").parent()
    			var $curobj=$(this)
    			var $subul=$(this).find('ul:eq(0)')
    			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
    			this.istopheader=$curobj.parents("ul").length==1? true : false
    			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
    			$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: arrowsvar.down[2]} : {}).append(
    				'<img src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])
    				+'" class="' + (this.istopheader? arrowsvar.down[0] : arrowsvar.right[0])
    				+ '" style="border:0;" />'
    					var $targetul=$(this).children("ul:eq(0)")
    					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
    					var menuleft=this.istopheader? 0 : this._dimensions.w
    					menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
    					if ($targetul.queue().length<=1) //if 1 or less queued animations
    						$targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).slideDown(jqueryslidemenu.animateduration.over)
    					var $targetul=$(this).children("ul:eq(0)")
    			) //end hover
    		}) //end $headers.each()
    		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
    	}) //end document.ready
    //build menu with ID="myslidemenu" on page:
    jqueryslidemenu.buildmenu("myslidemenu", arrowimages)
    Last edited by james438; 04-07-2020 at 10:29 PM. Reason: format

Similar Threads

  1. Change menu from hover into on-click
    By chechu in forum JavaScript
    Replies: 4
    Last Post: 02-20-2015, 11:58 AM
  2. Jqueryslidemenu - Different down arrow on hover
    By uncoordinated in forum CSS
    Replies: 1
    Last Post: 01-22-2015, 04:11 PM
  3. To change from mouse-click to mouse-hover on SlashDot menu script *please*
    By kevinhannan in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 08-28-2010, 09:22 PM
  4. Need to change Css from li:hover to a:hover
    By vlane95678 in forum CSS
    Replies: 4
    Last Post: 12-10-2008, 11:46 AM
  5. Image change on click, changeback on click
    By Racuda in forum Looking for such a script or service
    Replies: 2
    Last Post: 07-23-2007, 05:52 PM


Posting Permissions

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