调整文本大小的事件? [英] Resize event for textarea?

查看:108
本文介绍了调整文本大小的事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前版本的Firefox和Chrome包括一个拖动处理程序来调整< textarea> 框。我需要捕获调整大小的事件,我认为jQuery的 resize()事件是很容易的,但它不起作用。

The current versions of Firefox and Chrome include a drag handler to resize a <textarea> box. I need to capture the resizing event, I thought it would be easy with jQuery's resize() event, but it doesn't work!

我也尝试过正常的 onResize 事件,但结果是一样的。 您可以在JSFiddle上试用

I have also tried the normal onResize event, but the result is the same. You can try it on JSFiddle.

是否有一种捕获它的方式?

Is there a way to capture it?

推荐答案

在发布resize事件之前,您需要首先使textarea可调整大小。您可以使用jQuery UI resizable()进行此操作,您可以在其中调用resize事件。

You need to first make the textarea resizable before issuing the resize event. You can do that by using jQuery UI resizable() and inside it you can call the resize event.

$("textarea").resizable({
    resize: function() {
        $("body").append("<pre>resized!</pre>");
    }
});

这篇关于调整文本大小的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆