Script not working in Safari

Glenn Blog, Glenn's Blog 0 Comments

We recently found an odd behaviour in Safari that stopped a script working on page load. We came back to the page and then it periodically worked, but on the whole it simply wasn’t firing up. If you have the same problem then we would advise the following:-

1. Make sure you are using valid HTML and Doctype. To validate your HTML you can visit the W3 Markup Validation Service

2. If you are loading the script with:-

$(document).ready(function() {

REPLACE it and TRY binding a load to window with:–

$(window).load(function() {

If you are loading an image then you can also use:-

$('img').load(function() {

Example:-


<script type="text/javascript">  
//$(document).ready(function() {
$(window).load(function() {
$(".your-div").carouFredSel({
height: 71,
width: 390,
debug: true,
auto	: {
		items 			: 5,
		duration		: 7500,
		easing			: "linear",
		timeoutDuration	: 0,
		pauseOnHover	: "immediate"
	}
}); 
});
</script>

This will fire the carouFredSel script. The script is a nice continuous jQuery Carousel / Slider / Marquee.

This fixes scripts where the elements haven’t finished loading and miraculously fixed our script issue in Safari.

Of course let’s not rule out that you have a syntax error in your script, but if it works on other browsers then the above may well sort it for you too. Let us know how you get on!

About the Author
Script not working in Safari Script not working in Safari 0da77002febbfe28d15144a57bbcc2c9 s 180 d mm r g

Glenn

A highly experienced WordPress Web Developer, Front-end and Back-end Developer & New Media Specialist with extensive knowledge of a wide spectrum of technologies in the Development and Creative Industries built up over a number of years.

Leave a Reply

Your email address will not be published. Required fields are marked *