我无法将图像映射添加到我的nivo滑块.下面是我正在使用的代码,这里是
the site的链接.有什么建议吗?
<div class="slider-wrapper theme-default">
<div id="slider" class="nivoSlider">
<img src="wp-content/themes/sourcetone/images/1-difference.png" data-thumb="wp-content/themes/sourcetone/images/1-difference.png" alt="" />
<img src="wp-content/themes/sourcetone/images/2-mood.png" data-thumb="wp-content/themes/sourcetone/images/2-mood.png" alt="" usemap="#mood" />
<img src="wp-content/themes/sourcetone/images/3-activity.png" data-thumb="wp-content/themes/sourcetone/images/3-activity.png" alt="" usemap="#activity" />
<img src="wp-content/themes/sourcetone/images/4-health.png" data-thumb="wp-content/themes/sourcetone/images/4-health.png" alt="" usemap="#health" />
<img src="wp-content/themes/sourcetone/images/5-buy.png" data-thumb="wp-content/themes/sourcetone/images/5-buy.png" alt="" usemap="#buy" />
</div>
<map name="mood" id="mood"><area shape="rect" coords="10,453,162,482" href="/products/our-products/more-info/" alt="" /><area shape="rect" coords="10,400,162,445" href="google play" alt="" /></map>
<map name="activity"><area shape="rect" coords="929,449,1081,478" href="/products/our-products/more-info/" alt="" /><area shape="rect" coords="929,398,1081,443" href="google play" alt="" /></map>
<map name="health"><area shape="rect" coords="11,449,163,478" href="/products/our-products/more-info/" alt="" /><area shape="rect" coords="11,396,163,441" href="google play" alt="" /></map>
<map name="buy"><area shape="rect" coords="563,251,790,314" href="/products/our-products/more-info/" alt="" /><area shape="rect" coords="563,333,790,375" href="google play" alt="" /></map>
</div>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.nivo.slider.js"></script>
<script type="text/javascript">
$(window).load(function() {
$('#slider').nivoSlider({
effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
animSpeed: 800, // Slide transition speed
pauseTime: 5000, // How long each slide will show
lastSlide: function(){}, // Triggers when last slide is shown
});
});
</script>
最佳答案 老实说,我不认为这是可能的,因为Nivo Slider实际上将你的图像分成几十个较小的图像.
基本上Nivo利用与精灵相同的技术,通过将图像加载到页面中(因此,缓存),然后将其用作几十个较小图像的背景,所述背景移动了所需的任何数量. div显示整个图像的所需部分.因此,您实际提供给Nivo的图像本身永远不会显示.
因为图像映射不能直接应用于div,所以必须使用某种客户端逻辑在div上创建自己的映射.如果这不可行,我建议您直接联系Nivo,询问他们是否有任何想法/解决方案,将直接与他们的插件集成.
如果您还有其他问题,请与我们联系.祝好运! 🙂