Commits

Max Bronsema committed d8a947f

Updated Javascript with the image attribute fix, Nigel's menu fix, and working Retina Sprites.

  • Participants
  • Parent commits 185fb20

Comments (0)

Files changed (1)

 * Place your code here.
 */
 
+Drupal.behaviors.imgAttributes = {
+    attach: function () {
+
+    //First check to see if an image is on the page, if not, do nothing
+    if ( $( 'img').length > 0 ) {
+      //Loop through each image found and retrieve the width and height.
+      //Then remove the width and height from the inline css.
+      //Finally write the width and height as attributes to the html img tag.
+      $('#main img').each(
+        function(){
+          var imgWidth = $(this).css( "width");
+          var removeWidth = $(this).css( "width", "" );
+          var imgHeight = $(this).css( "height" );
+          var removeHeight = $(this).css( "height", "");
+
+          $(this).attr("width",imgWidth);
+          $(this).attr("height", imgHeight);
+      });
+      //The figure wraps our images and if a height is set, it will not wrap
+      //around the text, only the image. This is basically height:auto.
+      $('#main figure').each(
+        function(){
+          var removeFigureHeight = $(this).css( "height", "");
+      });
+    }
+  }
+}
+
 Drupal.behaviors.siteNameTypography = {
 		attach: function () {
 
 	// START MENU EXPANSION CODE
 	Drupal.behaviors.menuExpansion = {
 		attach: function () {
-		
+
 		$(".expanded").click(function(e) {
 			if ($(this).hasClass("opened")) {
 				$(this).children().children().hide();
 
 				// Close all children as well
 				var x = $(this).children().children("li");
-		    
+
 				while (x.size() > 0) {
 	      				x.removeClass("opened");
 	      				x.children().children().hide();
 	     			$(this).parent().children().not(this).children().children().hide();
 	     			$(this).addClass("opened");
 	   		}
-		  
+
 			e.stopPropagation();
 		});