December 27, 201312 yr Hey guys! I've been working on the front end of a site for a client and I'm getting a really weird bug when some of the pages are loaded on Apple machines - the bug is not present on Windows based machines. The bug is apparent on some of the modules on the pages that contain them such as: URL: http://wasabiadmin.se/global-business-labs-front-end/archive-find-us/ Where the read more button is incorrectly placed over the text, however when the page is refreshed it looks normal. I am using an equal heights script I created to ensure the modules remain the same height as one another if the content in them differs. - Perhaps it is something to do with that? Code for the equal heights script: // calculate equal heights for modules function setMouleHeights(modules) { if (modules.length) { modules.css('height', 'auto'); var maxHeight = 0; var modulePadding = modules.css('padding-bottom'); var modulePadding = (parseInt(modulePadding, 10)); modules.each(function() { if ($(this).height() > maxHeight) { maxHeight = $(this).height(); } }); modules.css('height', maxHeight + modulePadding); } } setMouleHeights($('.location-module')); setMouleHeights($('.map-module')); setMouleHeights($('.case-module')); $(window).resize(function(){ setMouleHeights($('.location-module')); setMouleHeights($('.employee-module')); setMouleHeights($('.case-module')); }); Thanks for any help in advance!
December 27, 201312 yr I only get the problem with Mac>Safari (Mac>Chrome is fine). That suggests something Safari specific, could be the JS or CSS. Suggest disabling the javascript and see what difference that makes. If it clears the problem you'll know it's that, if not it could be the CSS that needs tweaking to accomodate quirks in Safari.
December 27, 201312 yr Author Think i've found the problem - the function is called one the document.ready function. Document.ready is fired even if images are still downloading -So here the height is calculated before the image has been fetched and the resulting height is incorrect. Need to look for a method that will determine once all the documents images are loaded and then call the set height function.
December 27, 201312 yr Author Fixed! I put the initial function call statements in the $(window).load() method which only fires once everything in the document has loaded including images. Thanks for the help 'BlueDreamer' and pointing me to the Js where the error was
Create an account or sign in to comment