我有一张幻灯片,我想在其中显示特定于每个设备的照片。iPhone、iPad、台式机。
我想用这样的东西来过滤掉每一个。显然 display:none 不会工作,因为它是 JavaScript,但这只是它应该如何工作的一般概念:
<style type="text/css">
@media only screen and (min-width: 800px) {
#slide-desktop{display:block;}
#slide-ipad{display:none;}
#slide-iphone{display:none;}
}
@media only screen and (min-width: 481px) and (max-width: 799px) {
#slide-desktop{display:none;}
#slide-ipad{display:block;}
#slide-iphone{display:none;}
}
@media only screen and (max-width: 480px) {
#slide-desktop{display:none;}
#slide-ipad{display:none;}
#slide-iphone{display:block;}
}
</style>
<div id="slide-desktop">
<script>
$.vegas('slideshow', {
delay:6000,
backgrounds:[
{ src:'images/slide/desktop.jpg', fade:600 },
]
})('overlay');
</script>
</div>
<div id="slide-ipad">
<script>
$.vegas('slideshow', {
delay:6000,
backgrounds:[
{ src:'images/slide/ipad.jpg', fade:600 },
]
})('overlay');
</script>
</div>
<div id="slide-iphone">
<script>
$.vegas('slideshow', {
delay:6000,
backgrounds:[
{ src:'images/slide/iphone.jpg', fade:600 },
]
})('overlay');
</script>
</div>