[ Index ] |
PHP Cross Reference of phpwcms V1.4.7 _r403 (01.11.10) |
[Summary view] [Print] [Text view]
1 /* 2 --- 3 4 script: Fx.SmoothScroll.js 5 6 name: Fx.SmoothScroll 7 8 description: Class for creating a smooth scrolling effect to all internal links on the page. 9 10 license: MIT-style license 11 12 authors: 13 - Valerio Proietti 14 15 requires: 16 - Core/Selectors 17 - /Fx.Scroll 18 19 provides: [Fx.SmoothScroll] 20 21 ... 22 */ 23 24 var SmoothScroll = Fx.SmoothScroll = new Class({ 25 26 Extends: Fx.Scroll, 27 28 initialize: function(options, context){ 29 context = context || document; 30 this.doc = context.getDocument(); 31 var win = context.getWindow(); 32 this.parent(this.doc, options); 33 this.links = $$(this.options.links || this.doc.links); 34 var location = win.location.href.match(/^[^#]*/)[0] + '#'; 35 this.links.each(function(link){ 36 if (link.href.indexOf(location) != 0) {return;} 37 var anchor = link.href.substr(location.length); 38 if (anchor) this.useLink(link, anchor); 39 }, this); 40 if (!Browser.Engine.webkit419) { 41 this.addEvent('complete', function(){ 42 win.location.hash = this.anchor; 43 }, true); 44 } 45 }, 46 47 useLink: function(link, anchor){ 48 var el; 49 link.addEvent('click', function(event){ 50 if (el !== false && !el) el = document.id(anchor) || this.doc.getElement('a[name=' + anchor + ']'); 51 if (el) { 52 event.preventDefault(); 53 this.anchor = anchor; 54 this.toElement(el).chain(function(){ 55 this.fireEvent('scrolledTo', [link, el]); 56 }.bind(this)); 57 link.blur(); 58 } 59 }.bind(this)); 60 } 61 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Nov 16 22:51:00 2010 | Cross-referenced by PHPXref 0.7 |