1

我正在使用一个子 Wordpress 主题(Blanco)并尝试使用 jQuery Masonry 制作一个图片库页面,除了 masonry 功能似乎不起作用,一切看起来就像它是浮动的。列有垂直间隙。FireBug 还检测到一个错误。TypeError: $("#pincontainer").masonry is not a function 画廊位于:www.christaalexandra.com/gallerie/

我的标题中有以下代码:

<?php wp_enqueue_script('jquery'); ?>
<?php wp_head(); ?>


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

<script language="javascript" type="text/javascript">  
// This line tells the script to run after the page is loaded,
// As well as allows you to use the `$` function within the script
jQuery(function($) {  
    $('#pincontainer').masonry({
        itemSelector: '.pin-gallery', 
    });
});
</script>

我的样式表中有以下 CSS:

#pincontainer{
margin:0 auto;
margin-top:50px;

}
.pin-gallery{
  width: 220px;
  margin: 10px;
  float: left;
}

我的图库页面具有以下 HTML:

<div id="pincontainer">
<div class="pin-gallery"><img src="/wp-content/uploads/2012/11/baby_shower_invitation_rocket_baby_spaceship_thank_you_card_stars_1.jpg" alt="" /></div>
<div class="pin-gallery"><img src="/wp-content/uploads/2012/11/black_and_white_inspiration_wedding_invitations.jpg" alt="" /></div>
<div class="pin-gallery"><img src="/wp-content/uploads/2012/11/blue_rope_ship__ocean_nautical_baby_shower_invitation_thank_you_card_4.jpg"  alt="" /></div>
...(more div's here)...

</div>
<!--End Container-->

为什么我的画廊堆叠不正确?JS 文件存在于我的子模板的 JS 文件夹中,它应该在其他地方吗?我花了几个小时研究这个,感觉好像我已经检查并仔细检查了潜在的问题,但我处于初学者水平,所以它可能是非常明显的。非常感谢您的帮助,在此先感谢您!

4

0 回答 0