jQuery调整插件最小宽度,具体取决于拖动的边缘 [英] Jquery resize plugin min width depending on which edge is being dragged

查看:117
本文介绍了jQuery调整插件最小宽度,具体取决于拖动的边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
jQuery可调整大小的插件,根据拖动边缘设置minWidth

Possible Duplicate:
Jquery resizable plugin, set minWidth depending on the dragging edge

如何根据要拖动的元素的边缘设置minWidth和height?

How can i set the minWidth and height depending on which edge of the element is being dragged?

推荐答案

有点奇怪的交互作用,但这就是( jsfiddle )

Kind of a weird interaction, but here it is (jsfiddle)

$(function() {
    $( "#resizable" ).resizable({
        handles : 'e, n, s, w',
        resize : function(event, ui){
            switch($(this).data('resizable').axis)
            {
                case 'n':
                    $(this).resizable( "option", "minHeight", 75 );
                    break;
                case 's':
                    $(this).resizable( "option", "minHeight", 100 );
                    break;
                case 'e':
                    $(this).resizable( "option", "minWidth", 150 );
                    break;
                case 'w':
                    $(this).resizable( "option", "minWidth", 200 );
                    break;
            }
        }
    });
});​

这篇关于jQuery调整插件最小宽度,具体取决于拖动的边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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