var dMCustomScrollbar=function(dw){ var wwidth=$(window).width(); if(wwidth>dw){ $('#bodyContent').width('100%'); }else{ $('#bodyContent').width(dw); } } $(function(){ dMCustomScrollbar(1366); $(window).resize(function(){ dMCustomScrollbar(1366); }); });