I have a problem with JQuery Toggle.
I have the following code:
var $_ = jQuery;
$_(document).ready(function(){
$_(\"#sh-zone-buttons\").delegate(\"#sh-
I've simplified it to:
var $_ = jQuery;
$_(document).ready(function() {
$_("#sh-zone-buttons")
.delegate("#sh-zone-button-login-menu", "click", function(event) {
$_("#sh-zone-login-menu").toggle();
$_(this).toggleClass("current");
return false;
});
});
You don't need to define var elem_core
if you are only going to use it once, so simply use $_(this).toggleClass("current");
You don't need all that hide/show mess, simply use toggle()
, as that's what it does for you.
You don't need event.stopPropagation()
and event.preventDefault()
, simply do return false
, as that does both.