简体   繁体   English

没有JavaScript的后备解决方案

[英]fallback solution without javascript

Bootstrap has its own javascript version of checkboxes, radio buttons , collapse etc. Bootstrap具有自己的javascript版本的复选框,单选按钮折叠等。

Example radio buttons: 单选按钮示例:

<div class="btn-group" data-toggle="buttons-radio">
  <button type="button" class="btn">Left</button>
  <button type="button" class="btn">Middle</button>
  <button type="button" class="btn">Right</button>
</div>

This looks pretty great as long you have JS enabled. 只要启用了JS,这看起来就很棒。 I like JS but I am also a NoScript user and I want that the page is also functional without JS. 我喜欢JS,但我也是NoScript用户,我希望没有JS的页面也能正常工作。

As I can see twitter-bootstrap has no built-in fallback solution. 如我所见,twitter-bootstrap没有内置的后备解决方案。 I could use my own tags or show the bootstrap buttons only if JS is enabled but I somehow expected that bootstrap could handle this. 仅在启用JS的情况下,我才可以使用自己的标签或显示引导按钮,但是我希望引导可以处理此问题。

Only solution I have in mind is using standard radio buttons, checkboxes etc. and replacing/hiding them with some like code from above if JS is enabled. 我想到的唯一解决方案是使用标准单选按钮,复选框等,如果启用了JS,则用上面的类似代码替换/隐藏它们。

I was also disappointed to see that some simple things like collapse have no fallback solution which would at least ie handle it with css3 transistions or at least just open all sub divs and keep them open. 我也很失望地看到诸如崩溃之类的一些简单的事情都没有回退解决方案,该解决方案至少可以通过css3跨域来处理它,或者至少只是打开所有子div并保持其打开状态。

Do you have some ideas/solutions for bootstrap without JS or is the only solutions writing a function to "hide radio buttons, show/create boostrap-divs if javascript enabled"? 您是否有一些不使用JS进行引导的想法/解决方案,或者是编写“隐藏单选按钮,如果启用了JavaScript则显示/创建boostrap-divs”功能的唯一解决方案?

You could handle it without javascript but that would require it to send it to a server side script or at least a form to submit it. 您可以在不使用javascript的情况下进行处理,但这将要求它将其发送到服务器端脚本或至少一个提交表单。 As most user (I think about 99%) have javascript enabled, you should disable the function when no javascript is activated. 由于大多数用户(我认为有99%)启用了javascript,因此,当未激活javascript时,您应该禁用该功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM