Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. var TINY={};
  2.  
  3. function T$(i){return document.getElementById(i)}
  4. function T$$(e,p){return p.getElementsByTagName(e)}
  5.  
  6. TINY.fader=function(){
  7. function fade(n,p){this.n=n; this.init(p)}
  8. fade.prototype.init=function(p){
  9. var s=T$(p.id), u=this.u=T$$('li',s), l=u.length, i=this.l=this.c=this.z=0;
  10. if(p.navid&&p.activeclass){this.g=T$$('li',T$(p.navid)); this.s=p.activeclass}
  11. s.style.overflow='hidden'; this.a=p.auto||0; this.p=p.resume||0;
  12. for(i;i<l;i++){
  13. if(u[i].parentNode==s){
  14. u[i].style.position='absolute'; this.l++; u[i].o=p.visible?100:0;
  15. u[i].style.opacity=u[i].o/100; u[i].style.filter='alpha(opacity='+u[i].o+')'
  16. }
  17. }
  18. this.pos(p.position||0,this.a?1:0,p.visible)
  19. },
  20. fade.prototype.auto=function(){
  21. this.u.ai=setInterval(new Function(this.n+'.move(1,1)'),this.a*1000)
  22. },
  23. fade.prototype.move=function(d,a){
  24. var n=this.c+d, i=d==1?n==this.l?0:n:n<0?this.l-1:n; this.pos(i,a)
  25. },
  26. fade.prototype.pos=function(i,a,v){
  27. for(j=0;j<this.u.length;j++){if(j!=this.c && j!=i)this.u[j].style.zIndex=0;}
  28. this.u[this.c].style.zIndex=1;
  29. var p=this.u[i]; p.style.zIndex=2;
  30. clearInterval(p.si); clearInterval(this.u.ai); this.u.ai=0; this.c=i;
  31. if(p.o>=100&&!v){p.o=0; p.style.opacity=0; p.style.filter='alpha(opacity=0)'}
  32. if(this.g){for(var x=0;x<this.l;x++){this.g[x].className=x==i?this.s:''}}
  33. p.si=setInterval(new Function(this.n+'.fade('+i+','+a+')'),20)
  34. },
  35. fade.prototype.fade=function(i,a){
  36. var p=this.u[i];
  37. if(p.o>=100){
  38. clearInterval(p.si); if((a||(this.a&&this.p))&&!this.u.ai){this.auto()}
  39. }else{
  40. p.o+=5; p.style.opacity=p.o/100; p.style.filter='alpha(opacity='+p.o+')'
  41. }
  42. };
  43. return{fade:fade}
  44. }();
  45.  
  46. fade.prototype.move=function(d,a) {
  47. if($(this).is(":hover") == false)
  48. var n=this.c+d, i=d==1?n==this.l?0:n:n<0?this.l-1:n; this.pos(i,a)
  49. }
  50.  
  51. fade.prototype.pause=function(){ clearInterval(this.u.ai); };
  52.  
  53. //code snippet of tinyfader.js
  54. ...,
  55. fade.prototype.fade=function(i,a){
  56. var p=this.u[i];
  57. if(p.o>=100)
  58. {clearInterval(p.si); if((a||(this.a&&this.p))&&!this.u.ai){this.auto()}
  59. }else{
  60. p.o+=5; p.style.opacity=p.o/100; p.style.filter='alpha(opacity='+p.o+')'
  61. }
  62. },
  63. fade.prototype.pause=function(){ clearInterval(this.u.ai); };
  64. //end snippet
  65.  
  66. fade.prototype.move=function(d,a) {
  67. if($("#"+$(this)[0]["n"]).is(":hover") == false) {
  68. var n=this.c+d, i=d==1?n==this.l?0:n:n<0?this.l-1:n; this.pos(i,a)
  69. }
  70. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement