与背景图像一起使用(Use with Background Images)
优质
小牛编辑
130浏览
2023-12-01
描述 (Description)
要设置背景图像,请使用“div”标记内的data-interchange属性。 您可以传递图像路径以设置匹配规则的background-image属性。
例子 (Example)
以下示例演示了在Foundation中使用与背景图像的交换 -
<!DOCTYPE html>
<html>
<head>
<title>Foundation Template</title>
<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 = "https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/js/foundation.min.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.js"></script>
</head>
<body>
<div data-interchange = "[/foundation/images/foundation-plugin/smallback.jpg, (small)],
[/foundation/images/foundation-plugin/mediumback.jpg, (medium)],
[/foundation/images/foundation-plugin/background.jpg, (large)]">
<h2>Welcome to xnip</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever since
the 1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book.
</p>
</div>
<script>
$(document).ready(function() {
$(document).foundation();
})
</script>
</body>
</html>