Jump to content

Jquery $(document).ready


smartalco

Recommended Posts

I'm working on a simple news ticker that is supposed to just swap an image and text blurb out. I've got the onClick working for the story headers, but I can't get the auto-change working.I ripped a bunch of this out of a different jQuery tutorial that didn't quite apply, so I've probably messed that up somehow.Right now Safari gives me a "TypeError: Result of expression '$' [undefined] is not a function." error at that line in the js file (but allows other functions in the file to run just fine) while FF seems to just ignore the entire file.Safari is finding the error at the first line of this (the $(document) line), and if I delete everything within the function, it is still getting the error, so I'm not sure what is wrong. jQuery is being included elsewhere.

$(document).ready(function() {	var speed = 5000;	var run = setInterval('ticker(0)', speed);		$('#news_content').hover(  	  		function() {  			clearInterval(run);  		},   		function() {  			run = setInterval('ticker(0)', speed);			}  	);		$('#links a').click(function () {  		//stop the slide show  		clearInterval(run);	 		  		//resume the slideshow  		run = setInterval('ticker(0)', speed);   		return false;  	});});

I'd take another simpler solution to this (auto-change script) as well if you know of one.

Link to comment
Share on other sites

Silly Q, but are you sure you're importing the jQuery library before you try to use it?

Link to comment
Share on other sites

Looking around more on other implementations on the server, I had to do this...

var $thing = jQuery.noConflict();$thing(document).ready(function() {...

So, yeah, jQuery was included :)I might be back with another question in this thread in a bit, depending on if I get this next piece working right...

Link to comment
Share on other sites

Ah, that is the harder error to spot, I think. I have only just started using jQuery and don't use any other libraries. I'm sure if I incorporate another I will spend days wondering why my jQuery no longer works, lol.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...