jQuery masonry plugin not being activated

拈花ヽ惹草 提交于 2020-01-07 03:12:10

问题


I'm trying to implement the jquery masonry images plugin, it seems to be setup right, but it's not working!

I debugged using my browser, and didn't see any errors.

What could I be doing wrong? Code is below. Thanks. Faisal

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script src="/assets/jquery.js"></script>
<script src="/assets/jquery.masonry.min.js"></script>
<style>
.item {
 width: 200px;
.... }

</style>
<div id="container">
<div class="item">
....
</div>

<script>
$(function(){
    var $container = $('#container');
    $container.imagesLoaded(function(){
      $container.masonry({
        itemSelector : '.tile',
        columnWidth : 240
      });
    });
});
</script>
</div>

回答1:


The only problem I can see from your code is this line:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>

You haven't added a "http:" to the beginning of your link to your jQuery file. Shouldn't it be:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>

Can you upload a jsFiddle version of your page?



来源:https://stackoverflow.com/questions/10346865/jquery-masonry-plugin-not-being-activated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!