jQuery Freetile插件不能按预期工作

时间:2013-12-29 09:58:25

标签: javascript jquery html css

我有一个div(带有类.feeds)的内容,每个内容的宽度为250px,但由内容决定,这是动态的。希望它们显示为Pinterest中可获得的内容,但只有两列。这工作正常,但每个div都有一个下拉按钮,单击时会显示隐藏的注释。单击下拉按钮时,它会隐藏下一个div后面的注释。我希望下一个评论可能会停止,但它不起作用。

我尝试更改点击的div 1000的z-index,但它工作正常,但我无法将下一个div的位置相对于点击的一个。

<div class = 'rows'>
  <div class='feed_blocks'>
    <div class='feeds'> <!-- this is iterated many times -->
      <!-- dynamic content goes here... -->
         <div class = 'morecomments'> </div>
    </div>
  </div>
</div>

这是CSS代码:

.feeds {
    background-color: rgb(235,243,243);
    border-radius: 7px;
    padding: 3px;
    width: 240px;
    float: left;
    position: relative;
    margin-top: 5px;
    font-weight: 400;
    line-height: 17.9333px;
}

jQuery代码:

$('.feed_blocks').freetile(); //Freetile plugin
$(".feeds").on('click', '.morecomments', function () {
            $this = $(this);
    $this.parents('.feeds').css('z-index', '1000'); // this is working
    $this.parents('.feed_blocks').closest('.feeds').css('position', 'relative'); // this is not working
});  

任何帮助将不胜感激。

0 个答案:

没有答案
相关问题