切换CSS类(Toggle a CSS class)
优质
小牛编辑
127浏览
2023-12-01
描述 (Description)
通过在元素中使用属性data-toggler data-animate ,可以将动画效果应用于切换。 使用Motion UI类,元素进出视图。
例子 (Example)
以下示例演示了在Foundation中使用toggler插件 -
<!doctype html>
<head>
<meta name = "viewport" content = "width = device-width, initial-scale = 1.0" />
<title>Reveal Animations</title>
<link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/css/foundation.css">
<link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/motion-ui/1.1.1/motion-ui.css">
<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>
</head>
<body>
<h2>Example of Toggle with animation</h2>
<button class = "button" data-toggle = "toggle">Toggle Panel</button>
<div class = "callout" id = "toggle" data-toggler data-animate = "hinge-in-from-top slide-out-right" style = "background-color:#8BD6EE;">
<h4>Welcome to xnip</h4>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting
industry.Lorem Ipsum has been the industry's standard dummy text.
</p>
</div>
<script>
$(document).ready(function() {
$(document).foundation();
})
</script>
</body>
</html>