简体   繁体   中英

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. Can anyone help please? :] 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

$(function() {

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

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


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


});   

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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