如何使用usemap与FadeSlideShow
How to use usemap with a FadeSlideShow?
我试图将usemap属性设置为添加到imagearray中的这些图像之一。下面的代码是javascript中的FadeSlide,但我想在其中一个图像上实例化一些地图属性。谢谢。
<script type="text/javascript">
var mygallery=new fadeSlideShow({
wrapperid: "fadeshow1",
dimensions: [250, 180],
imagearray: [
["http://i26.tinypic.com/11l7ls0.jpg", "", "", "Nothing beats relaxing next to the pool when the weather is hot."],
["http://i29.tinypic.com/xp3hns.jpg", "http://en.wikipedia.org/wiki/Cave", "_new", "Some day I'd like to explore these caves!"]
],
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
persist: false,
fadeduration: 500,
descreveal: "ondemand",
togglerid: ""
})
你可以用JS代码像
$('#fadeshow1').find('img').each(function() {
$(this).attr('usemap', '#imgmap');
});
我建议使用不同的插件。
问题是FadeSlide
为您生成标记,而不是增强文档中的现有标记。如果您想为图像使用一些自定义标记(例如usemap
属性),那么您的选择将受到限制。它还违背了渐进增强原则。
如果你使用像JQuery Cycle这样的插件,你可以很容易地合并sitemap:
<div id="slider">
<img src="http://img1.jpg" width="200" height="200" usemap="#mymap1" />
<img src="http://img2.jpg" width="200" height="200" usemap="#mymap2" />
</div>
然后在JavaScript中:
$('#slider').cycle();
这个插件在不同的选项方面也非常健壮