How do I pass $(this) as a parameter in the setTimeout function (method?)? Here's what I'm doing so far, which is working:
var Variables = {};
Variables.ResizeTimer = false;
Variables.$obj = null;
$('.draggable').resize(function() {
if (Variables.ResizeTimer !== false) {
clearTimeout(Variables.ResizeTimer);
}
Variables.$obj = $(this);
Variables.ResizeTimer = setTimeout(mySizer,
1000
);
});
Since Variables looks global you can use it inside the mySizer routine. If you don't want to have global variables you can create a closure:
$('.draggable').resize(function() {
if (Variables.ResizeTimer !== false) {
clearTimeout(Variables.ResizeTimer);
}
var $this = $(this);
Variables.ResizeTimer = setTimeout(function() {
mySizer($this);
}, 1000);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With