开发者

How come my simple JQuery code doesn't work? [closed]

开发者 https://www.devze.com 2023-01-27 13:33 出处:网络
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.

This question was caused by a typo or a problem that can no开发者_StackOverflow社区 longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.

Closed 8 years ago.

Improve this question
 <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>

And these are my divs...

<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&#39;s paradise?
                    </div> 
                 </div> 
            </div> 
        </div> 

Here's the CSS

.imagedivholder {
    float:left;
    position:relative;
    margin:10px;
    width:230px;
    height:230px;

}

I followed all the instructions here: http://tobia.github.com/CrossSlide/


You've got one extra } after the last ].


To begin with, you've got a simple syntax error.

$(function(){
    $(".imagedivholder").each(function(e){
        $(this).crossSlide({
            speed:45, fade:1
        },[
            { src: $(this).attr("rel"), dir:'up' },
            { src: $(this).attr("rel"), dir:'down' },
        ]);
    });
});

Try learning to use Firebug. It'll help you spot simple errors like these. If you still have problems, let us know.

0

精彩评论

暂无评论...
验证码 换一张
取 消