条件:
$(document).ready(function() {
function stuff(){
//event.preventDefault()
new mlPushMenu(document.getElementById('menu'), document.getElementsByClassName('btnslick')[0], {
type : 'cover'
});
};
function jqUpdateSize(){
var windowwidth = $(window).width();
if (windowwidth <= 800){
//function on
} else {
//try to stop/off function and return to default
}
};
$(document).ready(jqUpdateSize);
$(window).resize(jqUpdateSize);
});
如何停止功能并返回默认值?
我试图存储到新功能并设置为开/关但不工作?
答案 0 :(得分:0)
做这样的事情
$(document).ready(function() {
function stuff(){
var windowwidth = $(window).width();
if (windowwidth <= 800){
new mlPushMenu( document.getElementById( 'menu' ), document.getElementsByClassName( 'btnslick' )[0], {
type : 'cover'
});
}
};
function jqUpdateSize(){
$(window).on('load',stuff);
};
$(document).ready(jqUpdateSize);
$(window).resize(jqUpdateSize);
});