点击这里
优质
小牛编辑
131浏览
2023-12-01
描述 (Description)
可以使用其配置设置自定义插件。 例如,您可以设置accordion幻灯片的速度上下。 可以使用插件的DEFAULTS属性全局更改插件设置。
Foundation.Accordion.defaults.slideSpeed = 600;
Foundation.Accordion.defaults.multiExpand = true;
通过更改HTML设置或JavaScript,可以使用不同的设置设置插件。 HTML中的每个设置都被定义为单个数据属性。
例子 (Example)
以下示例演示如何在Foundation中配置插件。
<html>
<head>
<title>JavaScript Configuring Plugins</title>
<link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/css/foundation.css">
</head>
<body>
<ul class = "accordion" data-accordion data-slide-speed = "600" role = "tablist">
<li class = "accordion-item is-active">
<a href = "#collapse1" role = "tab" class = "accordion-title" id = "collapse1-heading">Foundation</a>
<div id = "collapse1" class = "accordion-content" role = "tabpanel" data-tab-content aria-labelledby = "panel1d-heading">
The most advanced responsive front-end framework.
</div>
</li>
<li class = "accordion-item">
<a href = "#collapse2" role = "tab" class = "accordion-title" id = "collapse2-heading">CSS</a>
<div id = "collapse2" class = "accordion-content" role = "tabpanel" data-tab-content aria-labelledby = "panel1d-heading">
CSS describes the presentation of an HTML documents.
</div>
</li>
<li class = "accordion-item">
<a href = "#collapse3" role = "tab" class = "accordion-title" id = "collapse3-heading">HTML</a>
<div id = "collapse3" class = "accordion-content" role = "tabpanel" data-tab-content aria-labelledby = "panel1d-heading">
HTML is a markup language for describing web documents.
</div>
</li>
</ul>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/foundation.min.js"></script>
<script>
$(document).ready(function() {
$(document).foundation();
})
</script>
</body>
</html>