Jquery resizable plugin, set minWidth depending on the dragging edge

前端 未结 1 806
情深已故
情深已故 2021-01-22 07:53

So I have an image, around it is a crop marker, I don\'t want to be able to resize the crop marker smaller than the image.

To do that I will need to set the minWidth of

相关标签:
1条回答
  • 2021-01-22 08:09

    It looks like you posted this question twice. Here is my answer from the other question: 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;
                }
            }
        });
    });​
    
    0 讨论(0)
提交回复
热议问题