Isotope不会重新加载onkeypress

时间:2014-09-10 22:33:22

标签: javascript jquery jquery-isotope

当我使用onkeypress时,同位素('reloadItems')将不会重新加载布局,这意味着textarea被推到下面的项目下面。有人可以帮忙吗? :] jsfiddle

<script src='assets/scripts/textareagrow.js'></script>
<script src='assets/scripts/isotope.js'></script>
<script>
$(function() {

    $('.trans_comment').css('overflow', 'hidden').autogrow();

    $('.main_trans_contain').isotope({
        itemSelector: '.item'
    });

});
</script>



<div class='main_trans_contain'>

    <div class='item' style='width: 300px;margin: 10px;'>

        <textarea onkeypress="$('.main_trans_contain').isotope('reloadItems');" class='trans_comment'></textarea>

    </div>

</div>

1 个答案:

答案 0 :(得分:0)

使用&#39; layout&#34;而不是'reloadItems&#39; jsFiddle

$(function() {

$('.trans_comment').css('overflow', 'hidden').autogrow();

$('.main_trans_contain').isotope({
itemSelector: '.item'
});


$('.trans_comment').on('input', function(){
$('.main_trans_contain').isotope('layout');
});


});