[英]Fallback for display:none / visibility:hidden in case javascript is disabled
Basically I initially set certain elements to display: none;
基本上,我最初将某些元素设置为
display: none;
and visibility: hidden;
和
visibility: hidden;
in my css file and that make them visible with help of jQuery. 在我的css文件中,并借助jQuery使它们可见。 I was thinking, if users have javascript disabled, that would mean that they will not see any of these hidden elements at all.
我在想,如果用户禁用了javascript,那就意味着他们根本看不到任何这些隐藏元素。 How could I create a sort of a fallback in order to display this content to browsers with disabled javascript?
我如何创建某种后备广告,以便将这些内容显示给禁用了JavaScript的浏览器?
In your head, place something like : 在您的头上放置以下内容:
<noscript>
<style type="text/css">
.hidden_by_js_class {display: block;}
</style>
</noscript>
The HTML
<noscript>
Element defines a section of html to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser.如果页面上的脚本类型不受支持或当前在浏览器中关闭了脚本,则HTML
<noscript>
元素定义要插入的html部分。
You can use the tag : http://www.w3schools.com/tags/tag_noscript.asp 您可以使用标签: http : //www.w3schools.com/tags/tag_noscript.asp
<script type="text/javascript">
document.write("Javascript is On");
</script>
<noscript><span>Your Javascript is off</span></noscript>`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.