Joh*_*ack 4 jquery textarea resize bind
每当用户调整可调整大小的文本区域时,我都会尝试检测..
我正在尝试使用此代码,但它不起作用:
$('textarea.note').bind("resize", function(){
alert("resize!!!!!");
})
Run Code Online (Sandbox Code Playgroud)
我不想真的使用任何类型的计时器和循环..帮助!?
$(document).ready(function () {
var $textareas = jQuery('textarea');
// set init (default) state
$textareas.data('x', $textareas.outerWidth());
$textareas.data('y', $textareas.outerHeight());
$textareas.mouseup(function () {
var $this = $(this);
if ($this.outerWidth() != $this.data('x') || $this.outerHeight() != $this.data('y')) {
alert($this.outerWidth() + ' - ' + $this.data('x') + '\n' + $this.outerHeight() + ' - ' + $this.data('y'));
}
// set new height/width
$this.data('x', $this.outerWidth());
$this.data('y', $this.outerHeight());
});
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5827 次 |
最近记录: |