I'm using the following JQuery code to control some style elements on mouse hover for a drop down menu solution:
$(window).load(function () {
// On hover show or hide
$("#menu ul li").hover(function(){
$(this).children("ul").show();
$(this).children("ul").css('background-image', 'none');
},
function(){
$(this).children("ul").hide();
})
// On hover show or hide
$("#menu ul ul li, #menu ul ul li a ").hover(function(){
$(this).css('color', '#666');
},
function(){
$(this).css('color', '#FFF');
})
});
See working example:
http://www.youmeusdesign.co.uk/menu_test
I would like to modify this so that I can replace the hover function with a click function. When the client is using a touch interface that does not support the hover functionality. Windows Phone for example. iOS works ok as the device already has some classes to handle hover events.
I've tried modifying my script replacing the .hover with .click but it does not work?
e.g.
$("#menu ul li").click(function(){
Any help would be most appreciated.