显示高度会禁用jQuery UI可调整大小 [英] Displaying height disables jquery ui resizable

查看:233
本文介绍了显示高度会禁用jQuery UI可调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jQuery UI创建自己的日历(某种).我已经在列表项中添加了resizablesortable,它们都可以完美地工作.下一步是在列表项中显示时间,这些时间在调整列表项的大小时会更新.我想从显示列表项内部的高度开始,但是这样做会禁用resizable函数.

I'm trying to create my own calendar (sort of) by using jQuery UI. I've added resizable and sortable to my list items and it all works perfect. The next was to display time inside the list items that update when the list items get resized. I wanted to start by displaying the height inside the list items, but doing that disables the resizable function.

像这样: http://jsfiddle.net/PaulvdDool/9PXNc/

在列表之外显示高度不会影响resizable事件. 像这样: http://jsfiddle.net/PaulvdDool/gBANx/1/

Displaying the height outside the list doesn't affect the resizable event. Like so: http://jsfiddle.net/PaulvdDool/gBANx/1/

我该如何解决?

推荐答案

请尝试:

function getHeight(event) {
    var height = $('#'+event).height();
    $('#'+event+' > p').html(height);
}

当您准备好使用jQuery时,为什么要使用document.getElementById().innerHTML? 诀窍是仅将新的html应用于"p"标记.

why you are using document.getElementById().innerHTML when you are jquery ready? The trick is to apply the new html only to the "p" tag.

我想如果你想使用

$('#'+event).html(height);

您需要另一个

$( ".event" ).resizable({
    grid: 10,
    minWidth: 250,
    maxWidth: 250,
    minHeight: 25,
});

在getHeight()方法内部.

inside your getHeight() Method.

这篇关于显示高度会禁用jQuery UI可调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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