Committer: dpetrov
LJSUP-12792: IE media queries supportU trunk/htdocs/js/livejournal.js
Modified: trunk/htdocs/js/livejournal.js =================================================================== --- trunk/htdocs/js/livejournal.js 2012-07-04 12:56:43 UTC (rev 22389) +++ trunk/htdocs/js/livejournal.js 2012-07-05 06:59:02 UTC (rev 22390) @@ -52,6 +52,7 @@ LiveJournal.initNotificationStream(); LiveJournal.initSpoilers(); + LiveJournal.initResizeHelper(); //ljuniq cookie is checked in PageStats/Omniture.pm now @@ -62,6 +63,30 @@ jQuery(LiveJournal.initPage); /** + * Special helper class is added to the body if browser doesn't support media queries and + * screen width is less then 1000px. + */ +LiveJournal.initResizeHelper = function() { + var $window = jQuery(window), + $body = jQuery('body'), + hasClass = false, + resizeFunc = LJ.throttle(function() { + if ($window.width() <= 1000) { + if (!hasClass) { + $body.addClass('l-width1000'); + hasClass = true; + } + } else if (hasClass) { + $body.removeClass('l-width1000'); + hasClass = false; + } + }, 500); + + $window.on('resize', resizeFunc); + resizeFunc(); +}; + +/** * Spoilers functionality - expand hidden text in posts when user clicks on corresponding link */ LiveJournal.initSpoilers = function() {