我可以暂时制作脚本"不存在"用CSS?

时间:2016-01-10 20:55:59

标签: html css

例如,

<div style='display:none;'>
    <!-- JavaScript scripts and php function that otherwise would run automatically -->
</div>

。比方说,我喜欢在移动设备上运行时不能运行的脚本。这有可能用CSS吗?

1 个答案:

答案 0 :(得分:0)

如果您想要一个不适合移动用户的JS代码,您可以这样做

if (!(typeof window.orientation !== 'undefined')) {
 //Code that is not available for mobile users 
}