// Cross-browser solution (IE support)
var resizeEvent = window.document.createEvent('UIEvents');
resizeEvent.initUIEvent('resize', true, false, window, 0);
window.dispatchEvent(resizeEvent);
//function for screen resize
function screen_resize() {
var h = parseInt(window.innerHeight);
var w = parseInt(window.innerWidth);
if(w <= 500) {
//max-width 500px
// actions here...
red();
} else if(w > 500 && w <=850) {
//max-width 850px
// actions here...
orange();
} else {
// 850px and beyond
// actions here...
green();
}
}
// Bind to the resize event of the window object
$(window).on("resize", function () {
// Set .right's width to the window width minus 480 pixels
$(".content .right").width( $(this).width() - 480 );
// Invoke the resize event immediately
}).resize();