Answer the question
In order to leave comments, you need to log in
Two oneclick functions?
There are such two functions.
How to make these functions in one button, so that when pressed, 1 function is performed, when pressed again, 2 functions, then again 1, and so on in a circle?
function OpenNewMenu() {
$("#new_darkness").fadeIn(300);
$("#new_menu_right").animate( { left:"0px"}, {queue:false, duration:160 }) // mmessage_block
.animate( { left:"0px"}, 300);
$("#menu_open_button").animate( { opacity:"0.4"}, {queue:false, duration:160 }) // mmessage_block
.animate( { opacity:"0.4"}, 300);
//$("body").attr("style");
//$("body").attr("style", "overflow-y: hidden;");
}
function HideNewMenu() {
//$("body").attr("style");
//$("body").attr("style", "overflow-y: auto;");
$("#new_darkness").fadeOut(300);
$("#new_menu_right").animate( { left:"-320px"}, {queue:false, duration:160 }) // mmessage_block
.animate( { left:"-320px"}, 300);
$("#menu_open_button").animate( { opacity:"1"}, {queue:false, duration:160 }) // mmessage_block
.animate( { opacity:"1"}, 300);
Answer the question
In order to leave comments, you need to log in
For example like this
$('#menu_open_button').on('click', function(){
var menu = $('#new_menu_right').toggleClass('hidden')
if (menu.hasClass('hidden')) {
OpenNewmenu()
} else {
Hidenewmenu()
}
})
$('.mySelector').toggle(function() {
OpenNewMenu()
}, function() {
Hidenewmenu()
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question