开发者

jQuery's resizable plugin: Which handle is used? [closed]

开发者 https://www.devze.com 2023-03-30 05:23 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 9 years a开发者_JAVA技巧go.

Improve this question

Could you please tell me how to know which of the handles (n, e, s, or w) is used to resized an element?


topic is old but I was looking for the same answer and found this method.

    var handleTarget; //set scope

    $('#resize-this').resizable({
      handles: 'n,e,s,w',

      start: function(ui,event){
        handleTarget = $(event.originalEvent.target);
      },

      resize: function(ui,event){
        if (handleTarget.hasClass('ui-resizable-s'){
           //do stuff
        }
      } 
    )}; 


handles String, Object Default:'e, s, se'

If specified as a string, should be a comma-split list of any of the following: 'n, e, s, w, ne, se, sw, nw, all'. The necessary handles will be auto-generated by the plugin.

If specified as an object, the following keys are supported: { n, e, s, w, ne, se, sw, nw }. The value of any specified should be a jQuery selector matching the child element of the resizable to use as that handle. If the handle is not a child of the resizable, you can pass in the DOMElement or a valid jQuery object directly.

Code examples

Initialize a resizable with the handles option specified.

$( ".selector" ).resizable({ handles: 'n, e, s, w' });

Get or set the handles option, after init.

//getter
var handles = $( ".selector" ).resizable( "option", "handles" );
//setter
$( ".selector" ).resizable( "option", "handles", 'n, e, s, w' );

source

0

精彩评论

暂无评论...
验证码 换一张
取 消