我怎样才能使它始终有效,而不是每次加载页面时都是如此?
$(function(){
$('#test').click(function () {
test();
});
});
var calledonetime = false;
function test()
{
if(calledonetime=== false)
{
calledonetime = true;
$('html').css("overflow","hidden");
}else
{
$('html').css("overflow","scroll");
$('html').css("overflow-x","hidden");
}
}
答案 0 :(得分:0)
愿这项工作:
Dim receipes(4)
Dim receipe
receipes(0) = "chicken soup" 'Chicken Soup
receipes(1) = "turkey" 'Turkey
receipes(2) = "mash potatoes" 'Mash Potatoes
receipes(3) = "yams" 'Yams
receipes(4) = "stuffing" 'Stuffing
For Each receipe In receipes
WScript.Echo receipe
Next
答案 1 :(得分:0)
JS:
$( document ).ready(function() {
$('#test').click(function () {
$('body').toggleClass("sroll");
});
});
CSS中的
body {
overflow: scroll;
}
body.no-scroll {
overflow: hidden;
}
答案 2 :(得分:0)
修正了它:添加:calledonetime = false; to else
$(function(){
$('#test').click(function () {
test();
});
});
var calledonetime = false;
function test()
{
if(calledonetime=== false)
{
calledonetime = true;
$('html').css("overflow","hidden");
}else
{
$('html').css("overflow","scroll");
$('html').css("overflow-x","hidden");
calledonetime = false;
}
}