How to overwrite a jQuery function or stop it from executing -
i have jquery function transforms wordpress menu floating menu , again.
i create demonstration panel in theme allows users toggle or switch between static , floating menu.
the working site can seen here: http://morphius.wpinsite.com
here jquery code sets menu floating.
function header_transform(){ window_y = $(window).scrolltop(); var wp_admin_height = "0px"; if ($("#wpadminbar").length > 0){ wp_admin_height = parseint($("#wpadminbar").height()) + "px"; } if (window_y > scroll_critical) { if (!($("#header-wrapper").hasclass("fixed"))){ $("#header-wrapper").hide(); $("#wrapper").css("margin-top", header_h + "px"); $("#header-wrapper").addclass("fixed").css("top", wp_admin_height); $("#header-wrapper").fadein(500); //$logo2_link.fadein().appendto(".header"); $logo2_link.fadein().prependto(".header"); fixedmenu = true; } } else { if (($("#header-wrapper").hasclass("fixed"))){ $("#header-wrapper").fadeout(500, function(){ $("#header-wrapper").removeclass("fixed"); $("#wrapper").css("margin-top", ""); $("#header-wrapper").fadein(300) }); $logo2_link.fadeout().remove(); fixedmenu = false; } } }
what want achieve if user clicks on demo options panel , sets menu "fixed" below jquery code not execute , transform menu.
by default below jquery code run. need way stop executing if clicks "fixed" menu option.
thanks
on beginning of function add sth this:
if($(".switcherfixed img").hasclass("selected")) { return; }
did help?
Comments
Post a Comment