切换隐藏可见溢出onclick [英] Toggling hide-visible overflow onclick
本文介绍了切换隐藏可见溢出onclick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是JQuery的新手,所以我请你帮助我..如何在点击下拉按钮菜单后关闭切换溢出后可以隐藏html中的溢出。
I'm a newbie in JQuery so I ask you help to me.. How I can hide overflow in html after click on dropdown button menu and after closing toggle overflow as visible.
我试过这个,但它只允许隐藏溢出。然后我如何切换隐藏滚动?
I tried this, but it allowed only to hide the overflow. Then how I can toggle hide-scroll?
$(document).ready(function() {
$('.button').on('click', function() {
$('html').css("overflow", "hidden");
});
});
推荐答案
你可以使用 .css()
的callBack函数,
You can do it by using .css()
's callBack function,
$(document).ready(function() {
$('.button').on('click', function() {
$('html').css("overflow", function(_,val){
return val == "hidden" ? "scroll" : "hidden";
});
});
});
这篇关于切换隐藏可见溢出onclick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文