comparison www/martin/js/ini.js @ 74:b7f9ade92165

added template for guitar version
author Rob Canning <rc@kiben.net>
date Sun, 29 Jun 2014 16:53:50 +0000
parents
children
comparison
equal deleted inserted replaced
73:0c3a2942ddee 74:b7f9ade92165
1 // Easing equation, borrowed from jQuery easing plugin
2 // http://gsgd.co.uk/sandbox/jquery/easing/
3 jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
4 return -c * ((t=t/d-1)*t*t*t - 1) + b;
5 };
6
7 jQuery(function( $ ){
8 /**
9 * Most jQuery.serialScroll's settings, actually belong to jQuery.ScrollTo, check it's demo for an example of each option.
10 * @see http://flesler.demos.com/jquery/scrollTo/
11 * You can use EVERY single setting of jQuery.ScrollTo, in the settings hash you send to jQuery.serialScroll.
12 */
13
14 /**
15 * The plugin binds 6 events to the container to allow external manipulation.
16 * prev, next, goto, start, stop and notify
17 * You use them like this: $(your_container).trigger('next'), $(your_container).trigger('goto', [5]) (0-based index).
18 * If for some odd reason, the element already has any of these events bound, trigger it with the namespace.
19 */
20
21 /**
22 * IMPORTANT: this call to the plugin specifies ALL the settings (plus some of jQuery.ScrollTo)
23 * This is done so you can see them. You DON'T need to specify the commented ones.
24 * A 'target' is specified, that means that #screen is the context for target, prev, next and navigation.
25 */
26 $('#screen').serialScroll({
27 target:'#sections',
28 items:'li', // Selector to the items ( relative to the matched elements, '#sections' in this case )
29 prev:'img.prev',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
30 next:'img.next',// Selector to the 'next' button (absolute too)
31 axis:'xy',// The default is 'y' scroll on both ways
32 navigation:'#navigation li a',
33 duration:500,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
34 force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
35
36 //queue:false,// We scroll on both axes, scroll both at the same time.
37 //event:'click',// On which event to react (click is the default, you probably won't need to specify it)
38 //stop:false,// Each click will stop any previous animations of the target. (false by default)
39 //lock:true, // Ignore events if already animating (true by default)
40 //start: 0, // On which element (index) to begin ( 0 is the default, redundant in this case )
41 //cycle:true,// Cycle endlessly ( constant velocity, true is the default )
42 //step:1, // How many items to scroll each time ( 1 is the default, no need to specify )
43 //jump:false, // If true, items become clickable (or w/e 'event' is, and when activated, the pane scrolls to them)
44 //lazy:false,// (default) if true, the plugin looks for the items on each event(allows AJAX or JS content, or reordering)
45 //interval:1000, // It's the number of milliseconds to automatically go to the next
46 constant:true, // constant speed
47
48 onBefore:function( e, elem, $pane, $items, pos ){
49 /**
50 * 'this' is the triggered element
51 * e is the event object
52 * elem is the element we'll be scrolling to
53 * $pane is the element being scrolled
54 * $items is the items collection at this moment
55 * pos is the position of elem in the collection
56 * if it returns false, the event will be ignored
57 */
58 //those arguments with a $ are jqueryfied, elem isn't.
59 e.preventDefault();
60 if( this.blur )
61 this.blur();
62 },
63 onAfter:function( elem ){
64 //'this' is the element being scrolled ($pane) not jqueryfied
65 }
66 });
67
68 /**
69 * No need to have only one element in view, you can use it for slideshows or similar.
70 * In this case, clicking the images, scrolls to them.
71 * No target in this case, so the selectors are absolute.
72 */
73
74 });