質問

I'm using the jQuery UI resize function, and when user is finished with the operation I'd like it to run this code:

var pl=$('#player iframe')[0];pl.src=pl.src;

Would a callback work? How would I insert it into the resize function?

Specifically, the code I'm using for resize is this:

 $(function() {
$( ".resizableaspect" ).resizable({
  aspectRatio: true,
    helper: "ui-resizable-helper"
});
});
役に立ちましたか?

解決

You are using jQueryUI I think.
This is the official documentation:
http://jqueryui.com/resizable/

The event stop is called when you have finished to resize your element.
Other event are:
- create
- resize
- start
- stop

Try this:

$(function() {
    $( ".resizableaspect" ).resizable({
      aspectRatio: true,
        helper: "ui-resizable-helper",
        stop: function(e, ui) {
             var pl=$('#player iframe')[0];pl.src=pl.src;
        }
    });
 });

他のヒント

resizable has an event called stop, which is "triggered at the end of the resize operation".

http://api.jqueryui.com/resizable/

$( ".resizableaspect" ).resizable({
    aspectRatio: true,
    helper: "ui-resizable-helper",
    stop: function(){
        // YOUR CODE HERE
    }
});
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top