Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: News content slideshow?

  1. #1
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default News content slideshow?

    Hello

    I'm looking for a script similar to the one found on this site. http://www.uka.org.uk/
    As you can see it automatically moves to the next news article every 8 or so seconds. The Image changes.
    However when you mouseover the menu on the right it brings up the image related to that news article.

    I've been searching for a while or something like this, there's similar scripts but usually doesn't incorporate the side menu.

    Any help would be appreciated.

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    .ss {
      position:relative;width:865px;height:295px;border:solid black 1px;
    }
    #images {
      position:relative;width:660px;height:295px;border:solid black 0px;
    }
    #images IMG{
      position:absolute;left:0px;height:0px;width:660px;height:295px;
    }
    
    #items {
      position:absolute;left:665px;top:0px;width:200px;
    }
    
    .item {
      position:relative;width:200px;height:35px;background-Color:#33CCCC;margin-bottom:2px;
    }
    
    .active {
      background-Color:#CCFFFF;
    }
    
    /*]]>*/
    </style></head>
    
    <body>
    <div class="ss" >
     <div id="images" >
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=59773&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=58656&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=39942&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=51599&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41574&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=58657&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41605&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41302&type=full&servicetype=Inline&customSizeId=0" />
     </div>
     <div id="items" >
      <div class="item" >Item 1</div>
      <div class="item" >Item 2</div>
      <div class="item" >Item 3</div>
      <div class="item" >Item 4</div>
      <div class="item" >Item 5</div>
      <div class="item" >Item 6</div>
      <div class="item" >Item 7</div>
      <div class="item" >Item 8</div>
     </div>
    </div>
    
    <script type="text/javascript">
    /*<![CDATA[*/
    
    function SS(o){
     var obj=document.getElementById(o.SSID);
     if (obj){
      this.parent=obj.parentNode;
      var frames=this.bycls(o.SSClassName,obj);
      this.frames=[];
      for (var z0=0;z0<frames.length;z0++){
       frames[z0].style.zIndex=z0>0?'0':'1';
       this.frames[z0]=frames[z0];
      }
      obj=document.getElementById(o.ItemID);
      if (obj){
       this.off=o.ItemClassName;
       this.on=this.off+' '+(o.ItemActiveClassName?' '+o.ItemActiveClassName:'');
       this.items=this.bycls(this.off,obj);
       for (var z1=0;z1<this.items.length;z1++){
        if (this.frames[z1]){
         this.addevt(this.items[z1],'mouseover','itemover',z1);
         this.addevt(this.items[z1],'mouseout','itemout',z1);
        }
       }
      }
      this.addevt(this.parent,'mouseover','pause');
      this.addevt(this.parent,'mouseout','mseout');
      this.hold=o.Duration||5000;
      this.cnt=0;
      this.GoTo(this.cnt);
      this.Auto();
     }
    }
    
    SS.prototype={
    
     Auto:function(){
      var oop=this;
      clearTimeout(this.to);
      this.to=setTimeout(function(){ oop.GoTo(oop.cnt+1); oop.Auto(); },this.hold);
     },
    
     GoTo:function(nu){
      clearTimeout(this.to);
      if (this.items[this.cnt]){
       this.items[this.cnt].className=this.off;
      }
      this.frames[this.cnt].style.zIndex='0';
      this.cnt=nu<this.frames.length?nu:0;
      if (this.items[this.cnt]){
       this.items[this.cnt].className=this.on;
      }
      this.frames[this.cnt].style.zIndex='1';
     },
    
     addevt:function(o,t,f,p){
      var oop=this;
      if (o.addEventListener) o.addEventListener(t,function(e){ return oop[f](p,e);}, false);
      else if (o.attachEvent) o.attachEvent('on'+t,function(e){ return oop[f](p,e); });
     },
    
     mseout:function(p,e){
      var e=window.event?window.event:arguments.callee.caller?arguments.callee.caller.arguments[0]:false;
      if (e&&e.type=='mouseout'){
       var obj=(e.relatedTarget)?e.relatedTarget:e.toElement;
       if (!obj){
        return;
       }
       while (obj.parentNode){
        if (obj==this.parent){
         return false;
        }
        obj=obj.parentNode;
       }
      }
      this.Auto();
     },
    
     pause:function(){
      clearTimeout(this.to);
     },
    
     itemover:function(nu){
      this.items[nu].className=this.on;
      this.GoTo(nu);
     },
    
     itemout:function(nu){
      this.items[nu].className=this.off;
     },
    
     bycls:function(nme,el){
     for (reg=new RegExp('\\b'+nme+'\\b'),els=el.getElementsByTagName('*'),ary=[],z0=0; z0<els.length;z0++){
      if(reg.test(els[z0].className)) ary.push(els[z0]);
     }
     return ary;
    }
    
    
    }
    
    new SS({
     SSID:'images',
     SSClassName:'img',
     Duration:2000,
     ItemID:'items',
     ItemClassName:'item',
     ItemActiveClassName:'active'
    });
    /*]]>*/
    </script>
    </body>
    
    </html>
    Last edited by vwphillips; 09-17-2010 at 11:19 AM.
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. The Following User Says Thank You to vwphillips For This Useful Post:

    paddyt007 (09-17-2010)

  4. #3
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    or

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    .ss {
      position:relative;width:865px;height:295px;border:solid black 1px;
    }
    #images {
      position:relative;width:660px;height:295px;border:solid black 0px;
    }
    #images IMG{
      position:absolute;left:0px;height:0px;width:660px;height:295px;
    }
    
    #items {
      position:absolute;left:665px;top:0px;width:200px;
    }
    
    .item {
      position:relative;width:200px;height:35px;background-Color:#33CCCC;margin-bottom:2px;
    }
    
    .active {
      background-Color:#CCFFFF;
    }
    
    /*]]>*/
    </style>
    <script type="text/javascript">
    // Animate (11-January-2010)
    // by Vic Phillips http://www.vicsjavascripts.org.uk
    
    // To progressively change the Left, Top, Width, Height or Opacity of an element over a specified period of time.
    // With the ability to scale the effect time on specified minimum/maximum values
    // and with three types of progression 'sin' and 'cos' and liner.
    
    // **** Application Notes
    
    // **** see http://www.vicsjavascripts.org.uk/Animate/Animate.htm
    
    // **** Functional Code(1.52K) - NO NEED to Change
    
    function zxcAnimate(mde,obj,srt){
     this.to=null;
     this.obj=typeof(obj)=='object'?obj:document.getElementById(obj);
     this.mde=mde.replace(/\W/g,'');
     this.data=[srt||0];
     return this;
    }
    
    zxcAnimate.prototype={
    
     animate:function(srt,fin,ms,scale,c){
      clearTimeout(this.to);
      this.time=ms||this.time||0;
      this.neg=srt<0||fin<0;
      this.data=[srt,srt,fin];
      this.mS=this.time*(!scale?1:Math.abs((fin-srt)/(scale[1]-scale[0])));
      this.c=typeof(c)=='string'?c.charAt(0).toLowerCase():this.c?this.c:'';
      this.inc=Math.PI/(2*this.mS);
      this.srttime=new Date().getTime();
      this.cng();
     },
    
     cng:function(){
      var oop=this,ms=new Date().getTime()-this.srttime;
      this.data[0]=(this.c=='s')?(this.data[2]-this.data[1])*Math.sin(this.inc*ms)+this.data[1]:(this.c=='c')?this.data[2]-(this.data[2]-this.data[1])*Math.cos(this.inc*ms):(this.data[2]-this.data[1])/this.mS*ms+this.data[1];
      this.apply();
      if (ms<this.mS) this.to=setTimeout(function(){oop.cng()},10);
      else {
       this.data[0]=this.data[2];
       this.apply();
       if (this.Complete) this.Complete(this);
      }
     },
    
     apply:function(){
      if (isFinite(this.data[0])){
       if (this.data[0]<0&&!this.neg) this.data[0]=0;
       if (this.mde!='opacity') this.obj.style[this.mde]=Math.floor(this.data[0])+'px';
       else zxcOpacity(this.obj,this.data[0]);
      }
     }
    
    }
    
    function zxcOpacity(obj,opc){
     if (opc<0||opc>100) return;
     obj.style.filter='alpha(opacity='+opc+')';
     obj.style.opacity=obj.style.MozOpacity=obj.style.WebkitOpacity=obj.style.KhtmlOpacity=opc/100-.001;
    }
    
    
    </script>
    
    
    </head>
    
    <body>
    <div class="ss" >
     <div id="images" >
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=59773&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=58656&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=39942&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=51599&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41574&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=58657&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41605&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41302&type=full&servicetype=Inline&customSizeId=0" />
     </div>
     <div id="items" >
      <div class="item" >Item 1</div>
      <div class="item" >Item 2</div>
      <div class="item" >Item 3</div>
      <div class="item" >Item 4</div>
      <div class="item" >Item 5</div>
      <div class="item" >Item 6</div>
      <div class="item" >Item 7</div>
      <div class="item" >Item 8</div>
     </div>
    </div>
    
    <script type="text/javascript">
    /*<![CDATA[*/
    
    function SS(o){
     var obj=document.getElementById(o.SSID);
     if (obj){
      this.parent=obj.parentNode;
      var frames=this.bycls(o.SSClassName,obj);
      this.frames=[];
      for (var z0=0;z0<frames.length;z0++){
       frames[z0].style.zIndex=z0>0?'0':'1';
       this.frames[z0]=new zxcAnimate('opacity',frames[z0],z0>0?0:100);
       zxcOpacity(frames[z0],z0>0?0:100);
      }
      obj=document.getElementById(o.ItemID);
      if (obj){
       this.off=o.ItemClassName;
       this.on=this.off+' '+(o.ItemActiveClassName?' '+o.ItemActiveClassName:'');
       this.items=this.bycls(this.off,obj);
       for (var z1=0;z1<this.items.length;z1++){
        if (this.frames[z1]){
        this.addevt(this.items[z1],'mouseover','itemover',z1);
        this.addevt(this.items[z1],'mouseout','itemout',z1);
        }
       }
      }
      this.addevt(this.parent,'mouseover','pause');
      this.addevt(this.parent,'mouseout','mseout');
      this.ms=o.Duration||1000;
      this.hold=o.Hold||this.ms*4;
      this.cnt=0;
      this.GoTo(this.cnt);
      this.Auto();
     }
    }
    
    SS.prototype={
    
     Auto:function(){
      var oop=this;
      clearTimeout(this.to);
      this.to=setTimeout(function(){ oop.GoTo(oop.cnt+1); oop.Auto(); },this.hold+this.ms);
     },
    
     GoTo:function(nu){
      clearTimeout(this.to);
      if (this.items[this.cnt]){
       this.items[this.cnt].className=this.off;
      }
      this.frames[this.cnt].obj.style.zIndex='0';
      this.frames[this.cnt].animate(this.frames[this.cnt].data[0],0,this.ms,[0,100]);
      this.cnt=nu<this.frames.length?nu:0;
      if (this.items[this.cnt]){
       this.items[this.cnt].className=this.on;
      }
      this.frames[this.cnt].obj.style.zIndex='1';
      this.frames[this.cnt].animate(this.frames[this.cnt].data[0],100,this.ms,[0,100]);
     },
    
     addevt:function(o,t,f,p){
      var oop=this;
      if (o.addEventListener) o.addEventListener(t,function(e){ return oop[f](p,e);}, false);
      else if (o.attachEvent) o.attachEvent('on'+t,function(e){ return oop[f](p,e); });
     },
    
     mseout:function(p,e){
      var e=window.event?window.event:arguments.callee.caller?arguments.callee.caller.arguments[0]:false;
      if (e&&e.type=='mouseout'){
       var obj=(e.relatedTarget)?e.relatedTarget:e.toElement;
       if (!obj){
        return;
       }
       while (obj.parentNode){
        if (obj==this.parent){
         return false;
        }
        obj=obj.parentNode;
       }
      }
      this.Auto();
     },
    
     pause:function(){
      clearTimeout(this.to);
     },
    
     itemover:function(nu){
      this.items[nu].className=this.on;
      this.GoTo(nu);
     },
    
     itemout:function(nu){
      this.items[nu].className=this.off;
     },
    
     bycls:function(nme,el){
     for (reg=new RegExp('\\b'+nme+'\\b'),els=el.getElementsByTagName('*'),ary=[],z0=0; z0<els.length;z0++){
      if(reg.test(els[z0].className)) ary.push(els[z0]);
     }
     return ary;
    }
    
    
    }
    
    new SS({
     SSID:'images',
     SSClassName:'img',
     Hold:2000,
     Duration:1000,
     ItemID:'items',
     ItemClassName:'item',
     ItemActiveClassName:'active'
    });
    /*]]>*/
    </script>
    </body>
    
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  5. The Following 2 Users Say Thank You to vwphillips For This Useful Post:

    azoomer (09-17-2010),paddyt007 (09-17-2010)

  6. #4
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by vwphillips View Post
    or

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    .ss {
      position:relative;width:865px;height:295px;border:solid black 1px;
    }
    #images {
      position:relative;width:660px;height:295px;border:solid black 0px;
    }
    #images IMG{
      position:absolute;left:0px;height:0px;width:660px;height:295px;
    }
    
    #items {
      position:absolute;left:665px;top:0px;width:200px;
    }
    
    .item {
      position:relative;width:200px;height:35px;background-Color:#33CCCC;margin-bottom:2px;
    }
    
    .active {
      background-Color:#CCFFFF;
    }
    
    /*]]>*/
    </style>
    <script type="text/javascript">
    // Animate (11-January-2010)
    // by Vic Phillips http://www.vicsjavascripts.org.uk
    
    // To progressively change the Left, Top, Width, Height or Opacity of an element over a specified period of time.
    // With the ability to scale the effect time on specified minimum/maximum values
    // and with three types of progression 'sin' and 'cos' and liner.
    
    // **** Application Notes
    
    // **** see http://www.vicsjavascripts.org.uk/Animate/Animate.htm
    
    // **** Functional Code(1.52K) - NO NEED to Change
    
    function zxcAnimate(mde,obj,srt){
     this.to=null;
     this.obj=typeof(obj)=='object'?obj:document.getElementById(obj);
     this.mde=mde.replace(/\W/g,'');
     this.data=[srt||0];
     return this;
    }
    
    zxcAnimate.prototype={
    
     animate:function(srt,fin,ms,scale,c){
      clearTimeout(this.to);
      this.time=ms||this.time||0;
      this.neg=srt<0||fin<0;
      this.data=[srt,srt,fin];
      this.mS=this.time*(!scale?1:Math.abs((fin-srt)/(scale[1]-scale[0])));
      this.c=typeof(c)=='string'?c.charAt(0).toLowerCase():this.c?this.c:'';
      this.inc=Math.PI/(2*this.mS);
      this.srttime=new Date().getTime();
      this.cng();
     },
    
     cng:function(){
      var oop=this,ms=new Date().getTime()-this.srttime;
      this.data[0]=(this.c=='s')?(this.data[2]-this.data[1])*Math.sin(this.inc*ms)+this.data[1]:(this.c=='c')?this.data[2]-(this.data[2]-this.data[1])*Math.cos(this.inc*ms):(this.data[2]-this.data[1])/this.mS*ms+this.data[1];
      this.apply();
      if (ms<this.mS) this.to=setTimeout(function(){oop.cng()},10);
      else {
       this.data[0]=this.data[2];
       this.apply();
       if (this.Complete) this.Complete(this);
      }
     },
    
     apply:function(){
      if (isFinite(this.data[0])){
       if (this.data[0]<0&&!this.neg) this.data[0]=0;
       if (this.mde!='opacity') this.obj.style[this.mde]=Math.floor(this.data[0])+'px';
       else zxcOpacity(this.obj,this.data[0]);
      }
     }
    
    }
    
    function zxcOpacity(obj,opc){
     if (opc<0||opc>100) return;
     obj.style.filter='alpha(opacity='+opc+')';
     obj.style.opacity=obj.style.MozOpacity=obj.style.WebkitOpacity=obj.style.KhtmlOpacity=opc/100-.001;
    }
    
    
    </script>
    
    
    </head>
    
    <body>
    <div class="ss" >
     <div id="images" >
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=59773&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=58656&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=39942&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=51599&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41574&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=58657&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41605&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41302&type=full&servicetype=Inline&customSizeId=0" />
     </div>
     <div id="items" >
      <div class="item" >Item 1</div>
      <div class="item" >Item 2</div>
      <div class="item" >Item 3</div>
      <div class="item" >Item 4</div>
      <div class="item" >Item 5</div>
      <div class="item" >Item 6</div>
      <div class="item" >Item 7</div>
      <div class="item" >Item 8</div>
     </div>
    </div>
    
    <script type="text/javascript">
    /*<![CDATA[*/
    
    function SS(o){
     var obj=document.getElementById(o.SSID);
     if (obj){
      this.parent=obj.parentNode;
      var frames=this.bycls(o.SSClassName,obj);
      this.frames=[];
      for (var z0=0;z0<frames.length;z0++){
       frames[z0].style.zIndex=z0>0?'0':'1';
       this.frames[z0]=new zxcAnimate('opacity',frames[z0],z0>0?0:100);
       zxcOpacity(frames[z0],z0>0?0:100);
      }
      obj=document.getElementById(o.ItemID);
      if (obj){
       this.off=o.ItemClassName;
       this.on=this.off+' '+(o.ItemActiveClassName?' '+o.ItemActiveClassName:'');
       this.items=this.bycls(this.off,obj);
       for (var z1=0;z1<this.items.length;z1++){
        if (this.frames[z1]){
        this.addevt(this.items[z1],'mouseover','itemover',z1);
        this.addevt(this.items[z1],'mouseout','itemout',z1);
        }
       }
      }
      this.addevt(this.parent,'mouseover','pause');
      this.addevt(this.parent,'mouseout','mseout');
      this.ms=o.Duration||1000;
      this.hold=o.Hold||this.ms*4;
      this.cnt=0;
      this.GoTo(this.cnt);
      this.Auto();
     }
    }
    
    SS.prototype={
    
     Auto:function(){
      var oop=this;
      clearTimeout(this.to);
      this.to=setTimeout(function(){ oop.GoTo(oop.cnt+1); oop.Auto(); },this.hold+this.ms);
     },
    
     GoTo:function(nu){
      clearTimeout(this.to);
      if (this.items[this.cnt]){
       this.items[this.cnt].className=this.off;
      }
      this.frames[this.cnt].obj.style.zIndex='0';
      this.frames[this.cnt].animate(this.frames[this.cnt].data[0],0,this.ms,[0,100]);
      this.cnt=nu<this.frames.length?nu:0;
      if (this.items[this.cnt]){
       this.items[this.cnt].className=this.on;
      }
      this.frames[this.cnt].obj.style.zIndex='1';
      this.frames[this.cnt].animate(this.frames[this.cnt].data[0],100,this.ms,[0,100]);
     },
    
     addevt:function(o,t,f,p){
      var oop=this;
      if (o.addEventListener) o.addEventListener(t,function(e){ return oop[f](p,e);}, false);
      else if (o.attachEvent) o.attachEvent('on'+t,function(e){ return oop[f](p,e); });
     },
    
     mseout:function(p,e){
      var e=window.event?window.event:arguments.callee.caller?arguments.callee.caller.arguments[0]:false;
      if (e&&e.type=='mouseout'){
       var obj=(e.relatedTarget)?e.relatedTarget:e.toElement;
       if (!obj){
        return;
       }
       while (obj.parentNode){
        if (obj==this.parent){
         return false;
        }
        obj=obj.parentNode;
       }
      }
      this.Auto();
     },
    
     pause:function(){
      clearTimeout(this.to);
     },
    
     itemover:function(nu){
      this.items[nu].className=this.on;
      this.GoTo(nu);
     },
    
     itemout:function(nu){
      this.items[nu].className=this.off;
     },
    
     bycls:function(nme,el){
     for (reg=new RegExp('\\b'+nme+'\\b'),els=el.getElementsByTagName('*'),ary=[],z0=0; z0<els.length;z0++){
      if(reg.test(els[z0].className)) ary.push(els[z0]);
     }
     return ary;
    }
    
    
    }
    
    new SS({
     SSID:'images',
     SSClassName:'img',
     Hold:2000,
     Duration:1000,
     ItemID:'items',
     ItemClassName:'item',
     ItemActiveClassName:'active'
    });
    /*]]>*/
    </script>
    </body>
    
    </html>


    Ah thank you very much vwphillips . I really like the faded effect in the second one.

    Thanks!

  7. #5
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    Very nice, Vic. Thanks a lot

  8. #6
    Join Date
    Sep 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi Vic,
    can you please give an example who to make the links work in the above code?
    I don't know how to make the links (item 1, item2 ...) clickable...

    Thanks
    Matthias
    Last edited by Matthias70; 09-21-2010 at 09:27 PM.

  9. #7
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    .ss {
      position:relative;width:865px;height:295px;border:solid black 1px;
    }
    #images {
      position:relative;width:660px;height:295px;border:solid black 0px;
    }
    #images IMG{
      position:absolute;left:0px;height:0px;width:660px;height:295px;
    }
    
    #items {
      position:absolute;left:665px;top:0px;width:200px;
    }
    
    .item {
      position:relative;width:200px;height:35px;background-Color:#33CCCC;margin-bottom:2px;
    }
    
    .active {
      background-Color:#CCFFFF;
    }
    
    /*]]>*/
    </style>
    <script type="text/javascript">
    // Animate (11-January-2010)
    // by Vic Phillips http://www.vicsjavascripts.org.uk
    
    // To progressively change the Left, Top, Width, Height or Opacity of an element over a specified period of time.
    // With the ability to scale the effect time on specified minimum/maximum values
    // and with three types of progression 'sin' and 'cos' and liner.
    
    // **** Application Notes
    
    // **** see http://www.vicsjavascripts.org.uk/Animate/Animate.htm
    
    // **** Functional Code(1.52K) - NO NEED to Change
    
    function zxcAnimate(mde,obj,srt){
     this.to=null;
     this.obj=typeof(obj)=='object'?obj:document.getElementById(obj);
     this.mde=mde.replace(/\W/g,'');
     this.data=[srt||0];
     return this;
    }
    
    zxcAnimate.prototype={
    
     animate:function(srt,fin,ms,scale,c){
      clearTimeout(this.to);
      this.time=ms||this.time||0;
      this.neg=srt<0||fin<0;
      this.data=[srt,srt,fin];
      this.mS=this.time*(!scale?1:Math.abs((fin-srt)/(scale[1]-scale[0])));
      this.c=typeof(c)=='string'?c.charAt(0).toLowerCase():this.c?this.c:'';
      this.inc=Math.PI/(2*this.mS);
      this.srttime=new Date().getTime();
      this.cng();
     },
    
     cng:function(){
      var oop=this,ms=new Date().getTime()-this.srttime;
      this.data[0]=(this.c=='s')?(this.data[2]-this.data[1])*Math.sin(this.inc*ms)+this.data[1]:(this.c=='c')?this.data[2]-(this.data[2]-this.data[1])*Math.cos(this.inc*ms):(this.data[2]-this.data[1])/this.mS*ms+this.data[1];
      this.apply();
      if (ms<this.mS) this.to=setTimeout(function(){oop.cng()},10);
      else {
       this.data[0]=this.data[2];
       this.apply();
       if (this.Complete) this.Complete(this);
      }
     },
    
     apply:function(){
      if (isFinite(this.data[0])){
       if (this.data[0]<0&&!this.neg) this.data[0]=0;
       if (this.mde!='opacity') this.obj.style[this.mde]=Math.floor(this.data[0])+'px';
       else zxcOpacity(this.obj,this.data[0]);
      }
     }
    
    }
    
    function zxcOpacity(obj,opc){
     if (opc<0||opc>100) return;
     obj.style.filter='alpha(opacity='+opc+')';
     obj.style.opacity=obj.style.MozOpacity=obj.style.WebkitOpacity=obj.style.KhtmlOpacity=opc/100-.001;
    }
    
    
    </script>
    
    
    </head>
    
    <body>
    <div class="ss" >
     <div id="images" >
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=59773&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=58656&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=39942&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=51599&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41574&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=58657&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41605&type=full&servicetype=Inline&customSizeId=0" />
      <img class="img" src="http://www.uka.org.uk/EasySiteWeb/getresource.axd?AssetID=41302&type=full&servicetype=Inline&customSizeId=0" />
     </div>
     <div id="items" >
      <div class="item" >Item 1</div>
      <div class="item" >Item 2</div>
      <div class="item" >Item 3</div>
      <div class="item" >Item 4</div>
      <div class="item" >Item 5</div>
      <div class="item" >Item 6</div>
      <div class="item" >Item 7</div>
      <div class="item" >Item 8</div>
     </div>
    </div>
    <a href="#" onclick="s1.GoTo(0); return false;" >GoTo(0);</a>
    <a href="#" onclick="s1.GoTo(1); return false;" >GoTo(1);</a>
    <a href="#" onclick="s1.GoTo(2); return false;" >GoTo(2);</a>
    <script type="text/javascript">
    /*<![CDATA[*/
    
    function SS(o){
     var obj=document.getElementById(o.SSID);
     if (obj){
      this.parent=obj.parentNode;
      var frames=this.bycls(o.SSClassName,obj);
      this.frames=[];
      for (var z0=0;z0<frames.length;z0++){
       frames[z0].style.zIndex=z0>0?'0':'1';
       this.frames[z0]=new zxcAnimate('opacity',frames[z0],z0>0?0:100);
       zxcOpacity(frames[z0],z0>0?0:100);
      }
      obj=document.getElementById(o.ItemID);
      if (obj){
       this.off=o.ItemClassName;
       this.on=this.off+' '+(o.ItemActiveClassName?' '+o.ItemActiveClassName:'');
       this.items=this.bycls(this.off,obj);
       for (var z1=0;z1<this.items.length;z1++){
        if (this.frames[z1]){
        this.addevt(this.items[z1],'mouseover','itemover',z1);
        this.addevt(this.items[z1],'mouseout','itemout',z1);
        }
       }
      }
      this.addevt(this.parent,'mouseover','pause');
      this.addevt(this.parent,'mouseout','mseout');
      this.ms=o.Duration||1000;
      this.hold=o.Hold||this.ms*4;
      this.cnt=0;
      this.GoTo(this.cnt);
      this.Auto();
     }
    }
    
    SS.prototype={
    
     Auto:function(){
      var oop=this;
      clearTimeout(this.to);
      this.to=setTimeout(function(){ oop.GoTo(oop.cnt+1); oop.Auto(); },this.hold+this.ms);
     },
    
     GoTo:function(nu){
      clearTimeout(this.to);
      nu=nu<this.frames.length?nu:0;
      if (this.frames[nu]){
       if (this.items[this.cnt]){
        this.items[this.cnt].className=this.off;
       }
       this.frames[this.cnt].obj.style.zIndex='0';
       this.frames[this.cnt].animate(this.frames[this.cnt].data[0],0,this.ms,[0,100]);
       this.cnt=nu;
       if (this.items[this.cnt]){
        this.items[this.cnt].className=this.on;
       }
       this.frames[this.cnt].obj.style.zIndex='1';
       this.frames[this.cnt].animate(this.frames[this.cnt].data[0],100,this.ms,[0,100]);
      }
     },
    
     addevt:function(o,t,f,p){
      var oop=this;
      if (o.addEventListener) o.addEventListener(t,function(e){ return oop[f](p,e);}, false);
      else if (o.attachEvent) o.attachEvent('on'+t,function(e){ return oop[f](p,e); });
     },
    
     mseout:function(p,e){
      var e=window.event?window.event:arguments.callee.caller?arguments.callee.caller.arguments[0]:false;
      if (e&&e.type=='mouseout'){
       var obj=(e.relatedTarget)?e.relatedTarget:e.toElement;
       if (!obj){
        return;
       }
       while (obj.parentNode){
        if (obj==this.parent){
         return false;
        }
        obj=obj.parentNode;
       }
      }
      this.Auto();
     },
    
     pause:function(){
      clearTimeout(this.to);
     },
    
     itemover:function(nu){
      this.items[nu].className=this.on;
      this.GoTo(nu);
     },
    
     itemout:function(nu){
      this.items[nu].className=this.off;
     },
    
     bycls:function(nme,el){
     for (reg=new RegExp('\\b'+nme+'\\b'),els=el.getElementsByTagName('*'),ary=[],z0=0; z0<els.length;z0++){
      if(reg.test(els[z0].className)) ary.push(els[z0]);
     }
     return ary;
    }
    
    
    }
    
    s1=new SS({
     SSID:'images',
     SSClassName:'img',
     Hold:2000,
     Duration:1000,
     ItemID:'items',
     ItemClassName:'item',
     ItemActiveClassName:'active'
    });
    /*]]>*/
    </script>
    </body>
    
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  10. #8
    Join Date
    Sep 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi Vic,
    this code still does not work. Your extension just shows three links below the images, but does not make item 1, item 2, item 3 on the right side of the images clickable...

    Matthias

  11. #9
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    Did you try the simple solution ?
    Code:
     <div class="item" ><a href="http://www.dynamicdrive.com">Item 1</a></div>
    ( sorry if I haven't understood your question correctly)

  12. #10
    Join Date
    Sep 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by azoomer View Post
    Did you try the simple solution ?
    Code:
     <div class="item" ><a href="http://www.dynamicdrive.com">Item 1</a></div>
    ( sorry if I haven't understood your question correctly)
    Yes, certainly I tried the simple solution, but it does not work...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •