.live 和文本区域自动调整大小
我正在使用 jquery 的小插件: jquery-plugin-autoresize
但我在 .live 中使用它时遇到问题。
有谁知道该怎么做?
我尝试过
$('textarea .blog_comment').live('autoResize', function(e,{
// On resize:
onResize : function() {
$(this).css({opacity:0.8});
},
// After resize:
animateCallback : function() {
$(this).css({opacity:1});
},
// Quite slow animation:
animateDuration : 300,
// More extra space:
extraSpace : 40
}){});;
但行不通。 请帮忙。谢谢/
I am using small plugin to jquery:
jquery-plugin-autoresize
But i have trouble with using it with .live.
Does anyone know how to do it?
I tried
$('textarea .blog_comment').live('autoResize', function(e,{
// On resize:
onResize : function() {
$(this).css({opacity:0.8});
},
// After resize:
animateCallback : function() {
$(this).css({opacity:1});
},
// Quite slow animation:
animateDuration : 300,
// More extra space:
extraSpace : 40
}){});;
But it won't work.
Please help. Thank you/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要在元素再次准备好后重新运行插件,例如在您正在使用的 AJAX 方法的
success
处理程序中,如下所示:或者使用类似
.livequery()
,如下所示:简短的版本是
.live()
对此不起作用......它是事件驱动的,所以不太适合运行大多数插件。You either need to re-run the plugin after your elements are ready again, e.g. in the
success
handler of whichever AJAX method you're using, like this:Or use a plugin like
.livequery()
, like this:The short version is that
.live()
doesn't work for this...it's event driven, so not really suited for running most plugins.您的问题的答案可以在这里找到:
动态加载 jQuery qTip 代码
The answer to your question can be found here:
Loading jQuery qTip code dynamically