3

在以下非常基本的示例中,开关可以正常工作并且样式正确。如果我只是将foundation.css 版本从5.5.2 更改为6.0.5,切换样式就会丢失。为什么开关在 Foundation 6.0 中不起作用???同样,只需将样式表更改为“ https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.5/css/foundation.css ”,它就会停止工作。

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Foundation Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/css/foundation.css">

  <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.5/js/foundation.min.js"></script></head>
<body>

<div style="padding:20px;">
  <div class="switch large">
    <input id="mySwitch1" type="checkbox">
    <label for="mySwitch1"></label>
  </div> 
</div>

</body>
</html>
4

1 回答 1

4

Foundation 在 6.0 版中稍微改变了它的命名方案,所以你需要更新你的 HTML 来匹配它。请参阅此处的文档:

http://foundation.zurb.com/sites/docs/switch.html

    <div class="switch large">
        <input class="switch-input" id="largeSwitch" type="checkbox" name="exampleSwitch">
        <label class="switch-paddle" for="largeSwitch">
            <span class="show-for-sr">Show Large Elephants</span>
        </label>
    </div>
于 2015-12-30T20:32:40.177 回答