jQuery可调整大小的句柄设置程序不起作用 [英] jQuery Resizable handles setter not working

查看:102
本文介绍了jQuery可调整大小的句柄设置程序不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery UI Resizable,并且我需要在初始化后设置handles选项.

i'm using jQuery UI Resizable, and i need to set handles option after the initialization.

我遵循了 API示例,并且初始化方法效果很好,但使用setter方法似乎不起作用. 我想念什么吗?

I followed the API example and initialization method works just fine, but setter method seems not working. Am i missing anything?

// Initialization works fine!
$('#containerGreen').resizable( { handles: "n, e, s, w" } );

// Setter NOT working
$('#containerRed').resizable();
$('#containerRed').resizable( "option", "handles", "n, e, s, w" );

实时 演示

推荐答案

这是一个已知的错误:

http://bugs.jqueryui.com/ticket/3423

问题的解决方法:

一个肮脏的解决方案是在init上启用您将需要的所有处理程序.

A dirty solution is to enable all the handlers that you are going to need on init.

在CSS中添加如下所示的类

Add a class like the following in CSS

.ui-hide-handler { 宽度:0!重要 高度:0!重要 }

.ui-hide-handler { width:0 !important; height:0 !important; }

并根据您的需要将类添加/删除到处理程序DIV中

and add/remove the class to the handler DIVs according to your needs

$('.ui-icon-gripsmall-diagonal-se',element).addClass('ui-hide-handler'); $('.ui-resizable-sw',element).addClass('ui-hide-handler');

$('.ui-icon-gripsmall-diagonal-se', element).addClass('ui-hide-handler'); $('.ui-resizable-sw', element).addClass('ui-hide-handler');

就像我说的那样,这是肮脏的解决方案,但是它可以工作.

As I said, it's dirty solution but it works.

这篇关于jQuery可调整大小的句柄设置程序不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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