View Single Post
Old 01-27-2013, 09:09 AM   PM User | #8
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,817
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
I think there's an error somewhere in your amended js which is causing the whole thing to fail. However, my original code is still not solving the issue. Also, just noticed I typed $(window).ready() not $(window).load() in my code above. Oops.

This is, I think, because the $(this).load() in the script is never completing on the initial load. If I take this function out, then the script works on this test page.

The amended code is:

Code:
$(window).load(function(){
	if($('.Rating img').length > 0) {
		$('.Rating img').each(function() {
			if($(this).height() == 0) {
					var imgName = $(this).attr('src').split('/');
					var imgKey = imgName.length-1;
					setProductListHeights(imgName[imgKey]);
			} else {
				setProductListHeights();
				return false;
			}
		});
	} else {
		setProductListHeights();
	}
});
I've attached my amended js file as a text file.
Attached Files
File Type: txt common.js.txt (29.9 KB, 22 views)
__________________
Use the W3C HTML Validator and CSS Validator to check your code and Firebug to see what css is applied to an element
Read Steve Krug's book Don't Make Me Think - essential reading on web usability
I don't recommend much, but I do recommend Clook for UK web hosting
SB65 is offline   Reply With Quote