<script src="http://code.jquery.com/jquery-1.4.3.js" type="text/javascript"></script>
<script src="https://github.com/tobia/CrossSlide/raw/master/jquery.cross-slide.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(".imagedivholder").each(function(e){
$(this).crossSlide({ speed:45, fade:1
},[
{src: $(this).attr("rel"), dir:'up' },
{src: $(this).attr("rel"), dir:'down' },
]
});
});
});
</script>
这些是我的div ...
<div class="awallpost">
<div class="imagedivholder" rel="http://farm4.static.flickr.com/3458/3889274600_f381d28003.jpg" >
<!--<a href="document/show?id=4cde4c258aad69014a0000e1"><img src="http://s3.amazonaws.com/fabletest/4e0bndzxsaf3qul2" width="230" height="230"></a>-->
<div class="trans_caption">
<div style="padding:6px">
The Docks and The City: ...
</div>
</div>
</div>
</div>
<div class="awallpost">
<div class="imagedivholder" rel="http://farm4.static.flickr.com/3454/3814350374_d37f82124b.jpg" >
<!--<a href="document/show?id=4cde4e1c8aad69014a00011e"><img src="http://s3.amazonaws.com/fabletest/vbparxeymqgndc8l" width="230" height="230"></a>-->
<div class="trans_caption">
<div style="padding:6px">
Earth's paradise?
</div>
</div>
</div>
</div>
这是CSS
.imagedivholder {
float:left;
position:relative;
margin:10px;
width:230px;
height:230px;
}
我按照这里的所有说明操作: http://tobia.github.com/CrossSlide/
答案 0 :(得分:5)
在最后}
之后,您还有一个]
。
答案 1 :(得分:2)
首先,您遇到了一个简单的语法错误。
$(function(){
$(".imagedivholder").each(function(e){
$(this).crossSlide({
speed:45, fade:1
},[
{ src: $(this).attr("rel"), dir:'up' },
{ src: $(this).attr("rel"), dir:'down' },
]);
});
});
尝试学习使用Firebug。它会帮助你发现像这样的简单错误。如果您仍有问题,请告诉我们。