当网站加载全屏时将设置为 false
var fullscreen = false;
然后我想根据全屏是真还是假对多个 div 做不同的事情。
var fullscreen = false;
fullscreen.on('click', function(){
if (fullscreen == false) {
fullscreen = true;
backgroundCurtain.css({"background" : "black", "padding" : "0"});
pictureInner.css({"width": "100%"});
fullscreen.css({"backgroundPosition" : "-26px 0"});
pictureContainer.css({"width" : "auto", "padding" : "0"});
imageResized.css({"maxHeight" : "100%", "maxWidth" : "100%"});
var imageWidth = imageResized.width();
pictureInner.css({"width" : imageWidth});
alert(imageWidth);
}
else if (fullscreen == true) {
fullscreen = false;
backgroundCurtain.removeAttr("style").children().removeAttr("style");
}
});
这根本不起作用,我不知道为什么?
对于那些想在现场调试它的人,请尝试按现场上的任何图片;https://dl.dropbox.com/u/9677524/Webbdesign/william.html(如果上传到公共 Dropbox 页面,脚本在 Chrome 上不起作用,afaik)