jeremyBass26
asked on
call a 'nested' function from outside
Hello, I'm sure this is easier then I'm thinking but ... what I need to do is fire the doSomething(); and or the "$(window).bind('resize', ...etc" functions out side of the "$('[class^=Round_gen]').f ilter(func tion() {... etc"
... right now they are inside so I could get them working... but they loop every time.... I want to do them all at once... just not sure how to call them for out side....
thanks for the help...
jeremyBass
... right now they are inside so I could get them working... but they loop every time.... I want to do them all at once... just not sure how to call them for out side....
thanks for the help...
jeremyBass
$(document).ready(function() {
var SORUCE = '/rounded_rectangle_r.swf';
$('.Round_gen53').attr('rel', '' + SORUCE + ':::transparent:45:0');
$('[class^=Round_gen]').filter(function() {
return /Round_gen[0-9]+/.test($(this).attr('class'));
}).each(function() {
$(this).each(function() {
var $this = $(this);
var params = $(this).attr('rel').split(':');
$(this).flash({
flashvars: {
rounded: ['' + params[4] + ''],
stroke_w: ['' + params[5] + ''].join(' ')
}
},
{
version: 8
},
function(htmlOptions) {
var self = this;
$this.css("padding-right", "" + params[11] + "px");
$this.css("position", "relative");
htmlOptions.width = self.offsetWidth;
htmlOptions.src = params[0];
htmlOptions.wmode = params[3];
this.innerHTML = '<div class="" style="">' + this.innerHTML + '</div>';
htmlOptions.height = this.firstChild.offsetHeight;
$this.addClass('').prepend($.fn.flash.transform(htmlOptions));
$(this).contents("embed").not(".readME").addClass("sizeME");
function doSomething() { //// move this out????
var NEWheight = self.childNodes[1].offsetHeight;
var NEWwidth = self.childNodes[1].offsetWidth;
$this.contents(".sizeME").css("height", NEWheight + 'px');
$this.contents(".sizeME").css("width", (NEWwidth + 20) + 'px');
$this.css("height", NEWheight + 'px');
var SAheight = $('.thrColLiqHdr').innerHeight();
//alert (SAheight);
$('.traction').css("height", SAheight + 'px');
};
var resizeTimer = null; //// move this out????
$(window).bind('resize', //// move this out????
function() {
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(doSomething, 3);
});
doSomething(); //// move this out????
});
});
});
var SAheight = $('.thrColLiqHdr').innerHeight();
//alert (SAheight);
$('.SA').prepend('<img class="traction" src="images/blank.gif" style="position:absolute; left:0px; top:0px; width:100%; height:'+ SAheight +';">');
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for responding
ASKER
I guess I'm just looking for a way refactor this function so it uses as little cpu cycles as possible...
thanks for the help...
jeremyBass