View Single Post
Old 09-30-2008, 06:42 PM   PM User | #6
NancyJ
Senior Coder

 
NancyJ's Avatar
 
Join Date: Feb 2005
Location: Bradford, UK
Posts: 3,162
Thanks: 19
Thanked 65 Times in 64 Posts
NancyJ will become famous soon enough
Ok, your example isn't even using javascript, you're not even close. To be fair, its not entirely your fault the 'demo' doesn't actually show you how to use his plugin.

1. You need to include jQuery.
2. You need to attach the code to the links click event, the easiest way to do that would be to change 'title' in your code to 'onclick'. They used the title in the demo page just to show you the code that would be run.
3. To use the easing you need additional code
4. To scroll sideways you need additional code
5. 800 is too small to see any animation with the easing option, try 8000
5. This is a really crappy plugin. I work with jQuery a lot, I've even developed a few plugins myself and this took me nearly an hour to get working

This is the extra code you need to make it work (as well as jQuery)
Code:
jQuery(function( $ ){
		//borrowed from jQuery easing plugin
		//http://gsgd.co.uk/sandbox/jquery.easing.php
		$.scrollTo.defaults.axis = 'xy'; 
		$.easing.elasout = function(x, t, b, c, d) {
			var s=1.70158;var p=0;var a=c;
			if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
			if (a < Math.abs(c)) { a=c; var s=p/4; }
			else var s = p/(2*Math.PI) * Math.asin (c/a);
			return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
		};
		});
__________________
http://www.hazelryan.co.uk

Last edited by NancyJ; 09-30-2008 at 06:45 PM..
NancyJ is offline   Reply With Quote