网址是:http://174.120.239.48/~peakperf/
下面是jQuery:
网站仍在大力开发中。
如果您将鼠标悬停在旋转木马上的“服务保留”上,您将看到该函数应该是什么样子的。鼠标悬停时,跨度元素会淡入,鼠标移出时会隐藏。有些卡住了,有些工作得很好。还请注意,当您单击向右箭头并在旋转木马中滚动时,跨度会卡住"on“。
如有任何帮助,将不胜感激,谢谢!
发布于 2011-02-24 08:03:42
您的标记无效,因为它缺少结束的"a“标记(如下所示)
</a>以下是代码中的错误。
<a href="#" id="homeslide6-show">
<img src="http://174.120.239.48/~peakperf/wp-content/themes/strausberg/images/home_service_retention.jpg" width="200" height="92" />
</li>
</ul>此外,通过使用each()函数,您的jquery代码可以减少大约90%。
例如,将一个id添加到您的ul中,如下所示
<ul id="mycarousel"> jQuery('#mycarousel').find('span').each(function(){
jQuery(this).hover(function() {
jQuery(this).next().fadeIn('slow');
return false;
}, function(){
jQuery(this).next().fadeOut('slow');
return false;
});
});这段代码固定在当前的html结构中,你应该使用类来使它更灵活。
发布于 2011-02-24 08:11:23
您似乎有多个标签具有相同的ID,这是不允许的。ID为"homeslide6-show"。在开始之前,还应该尝试停止动画,并将JavaScript简化为:
jQuery(document).ready(function() {
// hides the slickbox as soon as the DOM is ready
jQuery('#homeslide1, #homeslide2, #homeslide3, #homeslide4, #homeslide5, #homeslide6').hide();
// shows the slickbox on clicking the noted link Â
for (var i = 1; i <= 6; i++) {
jQuery('#homeslide' + i + '-show').parent().hover(
function(e, i) {
jQuery('#homeslide' + i).stop(true, true).fadeIn('slow');
e.preventDefault();
return false;
},
function(e, i){
jQuery('#homeslide' + i).stop(true, true).fadeOut('slow');
e.preventDefault();
return false;
}
);
}
});如果有效的话,请告诉我。
编辑过的
我上面的javascript是错误的。以下是工作原理:
jQuery(document).ready(function() {
// hides the slickbox as soon as the DOM is ready
jQuery('#homeslide1, #homeslide2, #homeslide3, #homeslide4, #homeslide5, #homeslide6').hide();
// shows the slickbox on clicking the noted link Â
for (var i = 1; i <= 6; i++) {
jQuery('#homeslide' + i + '-show').parent().data({element: '#homeslide' + i}).hover(
function() {
var element = jQuery('element');
jQuery(element).stop(true, true).fadeIn('slow');
return false;
},
function(){
var element = jQuery('element');
jQuery(element).stop(true, true).fadeOut('slow');
return false;
}
);
}
});https://stackoverflow.com/questions/5097935
复制相似问题