I’ve inherited some code from a previous developer who is now no longer contactable. I’m trying to get the function to reinitialize when the page is resized, but can’t seem to get it to do so.
I’m a bit of a jQuery noob, which doesn’t help.
The function is below:
(function ($) {
$.fn.setWidth = function (o) {
var vWidth = $("#wrapper").outerWidth(false) - 40;
};
})(jQuery);
I’ve tried the following to reinitialize it when the page resizes, but currently nothing happens. No errors are generated either.
$(window).resize(function() {
$().setWidth();
});
Any pointers would be gratefully received.
-Edit-
Sorry, I should point out there is more code within the setWidth function, but I trimmed it out. I’m just trying to get the main function to reinitialize on resize.
If you have a function
function pageResize(){that does thevar vWidth = $("#wrapper").outerWidth(false)-40;code, you can then recall that on page resize.So: