jQuery fine with Firefox, etc. Not working on any IE, can't find extra comma
My website, http://kenthomes.com.au/test/gallery.php, works fine in normal browsers like FF, Chrome, Safari and Opera, but on IE6-8, two of my jQuery plugins/scripts don't work.
I think I've managed to narrow it down to this portion of code:
$(document).ready(function() {
$('.kwicks').kwicks({
min : 99,
spacing : 10,
isVertical : true,
sticky : true,
event : 'click'
});
/* This is basic - uses default settings */
$("a.group").fancybox();
});
It seems when I remove the code to do with 'kwicks'
Fancybox works fine on IE, but add it in and neither of them will work. I've looked at the kwicks
code many times and I don't see any extra commas.
Is this a case of something else going wrong? The image scrolling header also relies on jQuery but is working fine in IE6-8.
PS: I just built a test page with all three scripts, minus the Google-analytics and pageTracker and IE8 reports no errors at all. In my .php
pages they reported an extra error concerning 'kwicks'
. The Javascript was copied-pasted from开发者_开发知识库 my .php
to this .html
page.
http://kenthomes.com.au/test/testing.html
I get the following error "_gat is undefined"
Try putting that code in your $(document).ready() function like this:
$(document).ready(function() {
$('.kwicks').kwicks({
min : 99,
spacing : 10,
isVertical : true,
sticky : true,
event : 'click'
});
/* This is basic - uses default settings */
$("a.group").fancybox();
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
var pageTracker = _gat._getTracker("UA-3222702-4");
pageTracker._trackPageview();
});
The Kwicks code appears broken on IE. If you load your page and click on the "Error on Page" icon in the lower left, you'll see two errors:
Message: '_gat' is undefined Line: 206 Char: 2 Code: 0 URI: http://kenthomes.com.au/test/gallery.php Message: Object doesn't support this property or method Line: 11 Char: 252 Code: 0 URI: http://kenthomes.com.au/test/misc/jquery.kwicks-1.5.1.pack.js
The second error is showing you that kwicks is broken, which is why your site 'works' when you remove the code that references it.
You are using google analytics code and _gat is not defined. Normally we define that before setting the account.
Remove the google analytics and verify if it is working.
analytics code looks somehting like below , first fix that error
var _gaq = _gaq || [];
_gaq.push(['t1._setAccount', 'UA-9999999-1'],
['t1._trackPageview'],
Well there are 2 errors coming up for me in IE.
'_gat' is undefined gallery.php, line 206 character 2
Object doesn't support this property or method jquery.kwicks-1.5.1.pack.js, line 11 character 252
_gat is to do with Google Analytics not being loaded properly.
The other error would be a lot easier to see if you switched to the non-packed version of kwicks whilst you debug this issue. Try that.
Thanks everyone for all your help! It's all fixed up now.
See: http://kenthomes.com.au/
I've replaced the Google-analytics code, and pageTracker code to proper code that doesn't cause an error.
In the end, after hours of pulling hair out. It turned out that the problem was was that the author had forgotten to define a variable properly. It turns out that this variable had the same name as a div ID that I had ('container').
So what IE8 reported was correct, I just didn't know what I was looking for. I simply had to go into the kwick/kwick.pack.js and add 'var' in front of 'container' and problem was solved.
It seems the author disappeared so he never released an updated version with this fix, but in the comment section, people who have gone through it, have rectified it. If only I wasn't under pressure, I would probably read up and save myself a lot of stress.
See: http://blog.jeremymartin.name/2008/06/kwicks-15-released.html (ctrl-f: container)
Thanks again for all your contributions.
精彩评论