Forums / Craftwork / Client-side / help please

ez
#27233 2010-11-22 14:35
AHHHH maybe my mistake... (i think i see it now)

<span>
            <li><a href="plug.php?e=contactus">Contact Us</a></li>
            <li><a href="plug.php?e=faq">F.A.Q</a></li>
            <li><a href="plug.php?e=faq&q=1">Recruitement</a></li>
            <li><a href="list.php?c=ranks">=XE= Ranks</a></li>
        </ul>
</span></li>

this span is also triggered by your code... so it appends a span, but there was already one there !

Try this my friend:


$(document).ready(function(){

	$("ul.subnav").parent().append("<span class="dropdownclicker"></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	$("ul.topnav li span.dropdownclicker").click(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
});      


You need to change some css to:

ul.topnav li span.dropdownclicker { /*--Drop down trigger styles--*/
	width: 13px;
	height: 35px;
	float: left;
	background: url(img/subnav_btn.gif) no-repeat center top;

This is just a quick answer, but I think you see what I mean.. and have pointed you in the good direction :)


greetings,

ez

Added 9 minutes later:

Maybe it could even be simpler....

leave your JS code like it was..
just remove the 'extra' span from the HTML.. :)
==- I say: Keep it EZ -==
This post was edited by ez (2010-11-22 14:47, 13 years ago)