can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r22390: LJSUP-12792: IE media queries support

Committer: dpetrov
LJSUP-12792: IE media queries support
U   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() {

Tags: can3p, dpetrov, js, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments