2014-09-10 17 views
1

當我使用onkeypress同位素('reloadItems')將不會重新加載佈局,這意味着textarea被推到下面的項目下。任何人都可以幫忙嗎? :] jsfiddle同位素將不會重新加載onkeypress

<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> 
+0

什麼'$( '#yourTextarea')。在( '輸入',函數(){$( ''.main_trans_contain')。isotope('reloadItems');});' – Cohars 2014-09-10 22:36:11

+0

that does not work:/ – James 2014-09-10 22:37:46

+0

你改變了選擇器'$('#yourTextarea')'和/或添加一個id到你的texterea。你可以做'$('textarea')'作爲測試目的,然後改變它。另外,「它不工作」應該永遠不會在這裏回答。 – Cohars 2014-09-10 22:41:55

回答

0

使用「佈局」,而不是 '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'); 
}); 


}); 
相關問題