简体   繁体   English

同位素不会在按键时重新加载

[英]Isotope won't reload onkeypress

When i'm using onkeypress the isotope('reloadItems') won't reload the layout which means the textarea gets pushed under the item below. 当我使用onkeypress时,isotope('reloadItems')不会重新加载布局,这意味着textarea被推送到下面的项下。 Can anyone help please? 有人可以帮忙吗? :] jsfiddle :] 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>

Use 'layout" instead of 'reloadItems' jsFiddle 使用“布局”而不是“ reloadItems” jsFiddle

$(function() {

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

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


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


});   

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM