Trigger action on window resize
$(window).resize(function() {
// stuff
});
$(window).trigger('resize');
===============
var imgControl = function() {
$('div.lb_img img').each(function () {
... // etc
});
};
$(document).ready(function () {
imgControl();
});
$(window).resize(function() {
imgControl();
});
===============
var resizeTimer;
$(window).on('resize', function(e) {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
// Run code here, resizing has "stopped"
}, 250);
});