alireza Posted December 30, 2009 Share Posted December 30, 2009 Im tryin to edit the java script for my categories on my website you can take a look at it www.vidoox.com its on the left side, the original script would open the sub categories under each category by just hovering on the category name but i played around with the script and i got it to here www.vidoox.com/js/general.js heres the original script: (untouched) www.vidoox.com/js/original.js what i wanted to get rid of was opening the sub categories by hovering, i want to make it that it opens the subcategories of each category by left clicking on the category and also left clicking again would close the subcategories , but it got messed up to this point that im stuck at. so if anyone could help me with the codings i would really appreciate it Link to comment https://forums.phpfreaks.com/topic/186636-need-some-help-with-this-java-script-please/ Share on other sites More sharing options...
Irresistable Posted December 30, 2009 Share Posted December 30, 2009 Are you trying to change it from a hover, to an onclick? If not, what are you actually doing? Link to comment https://forums.phpfreaks.com/topic/186636-need-some-help-with-this-java-script-please/#findComment-985768 Share on other sites More sharing options...
alireza Posted December 30, 2009 Author Share Posted December 30, 2009 Are you trying to change it from a hover, to an onclick? If not, what are you actually doing? yes thats exactly wat i was tryin to do but failed. do u know how i can do that? Link to comment https://forums.phpfreaks.com/topic/186636-need-some-help-with-this-java-script-please/#findComment-985777 Share on other sites More sharing options...
rajivgonsalves Posted December 30, 2009 Share Posted December 30, 2009 this should work function catlist() { $("#ul_categories li").unbind('click').click( function(){ var ul_subs = $(this).find('ul'); if(ul_subs.hasClass("hidden_li")) { ul_subs.removeClass(); ul_subs.addClass('visible_li') } else if(ul_subs.hasClass("visible_li")) { ul_subs.addClass("hidden_li"); ul_subs.removeClass('visible_li'); } } } Link to comment https://forums.phpfreaks.com/topic/186636-need-some-help-with-this-java-script-please/#findComment-985854 Share on other sites More sharing options...
alireza Posted December 30, 2009 Author Share Posted December 30, 2009 this should work function catlist() { $("#ul_categories li").unbind('click').click( function(){ var ul_subs = $(this).find('ul'); if(ul_subs.hasClass("hidden_li")) { ul_subs.removeClass(); ul_subs.addClass('visible_li') } else if(ul_subs.hasClass("visible_li")) { ul_subs.addClass("hidden_li"); ul_subs.removeClass('visible_li'); } } } thankyou very much it worked Link to comment https://forums.phpfreaks.com/topic/186636-need-some-help-with-this-java-script-please/#findComment-985868 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.