www.webdeveloper.com
Results 1 to 6 of 6

Thread: a slide show exclusively for text attached to css , any ideas ?

  1. #1
    Join Date
    May 2012
    Posts
    9

    a slide show exclusively for text attached to css , any ideas ?

    i'm looking for a slide show exclusively for text attached to css / that plays constantly / but with image files for the "back", "stop" & "forward" buttons.

    I've searched for 3 days for something practical for a slide show that could be practical for a text scenario exclusively. What I've found were mostly javascript slide show's that were mainly for images & i'm not experienced enough to modify them for text attached to css.

    the scenario im currently stuck with is 4 paragraphs in a div css overflow... not going to fly ascetically or in a appealing sense for my targeted audience.

    **the scenario i'm hoping to have, is for * 4 paragraphs ( 4 layers in the ss, preferably DIV tags so i can add css on a external style sheet) * have the slide show perpetually playing * image files on the left and right for " back " & "forward " buttons.* and a image file on the bottom for a " stop" button *

    if someone could give me a functional code & to educated me on where in the HTML to insert each portion of the code i'd greatly appreciate it , I've been searching since Thursday and here i am still looking on a Saturday morning !

    o yea , i guess i could do this in fireworks but the only option i see is for FLASH & i don't want to go that route . i JUST DOWNLOADED adobe EDGE , maybe i experiment with this... i was hoping for JavaScript of something similar THANKS!

  2. #2
    Join Date
    Nov 2010
    Posts
    1,053
    something like this..?

    Code:
    <html>
    <head>
    </head>
    <style>
    .left{display:inline}
    </style>
    <body>
    <input type="button" value="<" onclick="move('down')" class="left"/>
    <div id="results" class="left">this is paragraph one</div>
    <input type="button" value=">" onclick="move('up')" class="left"/><br>
    <input type="button" value="stop" onclick="pause()" />
    <script type="text/javascript">
    var paras=["this is paragraph one", "...and paragraph two", "followed by paragraph three", "and paragraph four"];
    function move(dir){
    if(timer){clearTimeout(timer)}
    if(dir=="down"){
    paras.unshift(paras.pop())
    } if(dir=="up"){
    paras.push(paras.shift())
    
    }
    timer=setTimeout(function (){move(dir)}, 2000)
    document.getElementById("results").innerHTML=paras[0];
    }
    var timer=setTimeout(function (){move("up")}, 2000)
    
    function pause(){
    clearTimeout(timer);
    }
    </script>
    
    </body>
    </html>

  3. #3
    Join Date
    May 2012
    Posts
    9

    resolved

    @xelawho THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  4. #4
    Join Date
    May 2012
    Posts
    9

    Thumbs up

    Quote Originally Posted by xelawho View Post
    something like this..?

    Code:
    <html>
    <head>
    </head>
    <style>
    .left{display:inline}
    </style>
    <body>
    <input type="button" value="<" onclick="move('down')" class="left"/>
    <div id="results" class="left">this is paragraph one</div>
    <input type="button" value=">" onclick="move('up')" class="left"/><br>
    <input type="button" value="stop" onclick="pause()" />
    <script type="text/javascript">
    var paras=["this is paragraph one", "...and paragraph two", "followed by paragraph three", "and paragraph four"];
    function move(dir){
    if(timer){cleartimeout(timer)}
    if(dir=="down"){
    paras.unshift(paras.pop())
    } if(dir=="up"){
    paras.push(paras.shift())
    
    }
    timer=settimeout(function (){move(dir)}, 2000)
    document.getelementbyid("results").innerhtml=paras[0];
    }
    var timer=settimeout(function (){move("up")}, 2000)
    
    function pause(){
    cleartimeout(timer);
    }
    </script>
    
    </body>
    </html>
    thank you !!!!!!!!!!!!!!!!!!!!!!!

  5. #5
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,670
    can be used for Divs or images

    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[*/
    
    .parent {
      position:relative;left:200px;top:200px;width:200px;height:110px;border:solid red 1px;
    }
    
    .div {
      position:relative;width:200px;height:100px;background-Color:#FFFFCC;border:solid red 1px;float:left;
    }
    
    /*]]>*/
    </style></head>
    
    <body>
    
     <div id="tst" class="parent" onmouseover="S1.Pause();" onmouseout="S1.Auto();" >
      <div class="slide" >
       <div class="div" >0</div>
       <div class="div" >1</div>
       <div class="div" >2</div>
       <div class="div" >3</div>
      </div>
     </div>
    <input type="button" name="" value="Auto" onmouseup="S1.Auto();" />
    <input type="button" name="" value="Pause" onmouseup="S1.Pause();" />
    <input type="button" name="" value="Forward" onmouseup="S1.Step(-1);" />
    <input type="button" name="" value="Back" onmouseup="S1.Step(1);" />
     <div id="tstV" class="parent" onmouseover="S2.Pause();" onmouseout="S2.Auto();" style="left:800px;" >
      <div class="slide" >
       <div class="div" >0</div>
       <div class="div" >1</div>
       <div class="div" >2</div>
       <div class="div" >3</div>
      </div>
     </div>
    
    
    
    <script type="text/javascript">
    /*<![CDATA[*/
    // DIV Slide Show  (13-May-2012)
    // by Vic Phillips - http://www.vicsjavascripts.org.uk/
    
    function zxcDIVSlideShow(o){
     var oop=this,mde=o.Mode,mde=typeof(mde)=='string'&&mde.charAt(0).toUpperCase()=='V'?['top','left','height','offsetTop','offsetHeight']:['left','top','width','offsetLeft','offsetWidth'],p=document.getElementById(o.ID),slide=p.getElementsByTagName('DIV')[0],clds=slide.childNodes,ary=[],lft,sz,clode,ms=o.SlideDuration,hold=o.HoldDuration,srt=o.AutoStart,z0=0;
     p.style.overflow='hidden';
     slide.style.position='absolute';
     slide.style[mde[2]]='30000px';
     for (;z0<clds.length;z0++){
      if (clds[z0].nodeType==1){
       lft=clds[z0][mde[3]];
       ary.push(lft);
       sz=lft+clds[z0][mde[4]];
      }
     }
     slide.style[mde[2]]=sz+5+'px';
     clone=slide.cloneNode(true);
     clone.style[mde[1]]='0px';
     clone.style[mde[0]]=sz+'px';
     slide.appendChild(clone);
     clone=clone.cloneNode(true);
     clone.style[mde[0]]=-sz+'px';
     slide.appendChild(clone);
     oop.mde=mde[0];
     oop.obj=slide;
     oop.ary=ary;
     oop.sz=sz;
     oop.ms=typeof(ms)=='number'?ms:1000;
     oop.hold=typeof(hold)=='number'?hold:oop.ms*2;
     oop.cnt=0;
     oop.ud=-1;
     oop.now=0;
     if (typeof(srt)=='number'){
      oop.Auto(srt);
     }
    }
    
    zxcDIVSlideShow.prototype={
    
     Step:function(ud,auto){
      ud=typeof(ud)=='number'?ud>0?1:-1:-1;
      var oop=this,ary=oop.ary,cnt=this.cnt+ud;
      oop.Pause();
      if (typeof(ary[cnt])!='number'){
       oop.now+=oop.sz*(ud>0?-1:1);
       cnt=ud>0?0:ary.length-1;
      }
      oop.ud=ud;
      oop.auto=auto===true;
      oop.cnt=cnt;
      clearTimeout(oop.dly);
      oop.animate(oop.mde,oop.now,ary[cnt],new Date(),this.ms);
     },
    
     Auto:function(ms){
      var oop=this;
      oop.Pause();
      oop.to=setTimeout(function(){ oop.Step(oop.ud,true); },ms||500);
     },
    
     Pause:function(){
      this.auto=false;
      clearTimeout(this.to);
     },
    
     animate:function(mde,f,t,srt,mS){
      var oop=this,ms=new Date().getTime()-srt,now=(t-f)/mS*ms+f;
      if (isFinite(now)){
       oop.now=now;
       oop.obj.style[mde]=now+'px';
      }
      if (ms<mS){
       oop.dly=setTimeout(function(){ oop.animate(mde,f,t,srt,mS); },10);
      }
      else {
       oop.now=t;
       oop.obj.style[mde]=t+'px';
       if (oop.auto){
        oop.Auto(oop.hold);
       }
      }
     }
    
    }
    
    S1=new zxcDIVSlideShow({
     ID:'tst',            // the unique ID name of the parent node.                       (string)
     Mode:'horizontal',   //(optional) the mode of execution, 'horizontal' or 'vertical'. (string, default = 'horizontal')
     SlideDuration:1000,  //(optional) the slide duration in milli seconds.               (number, default = 1000)
     HoldDuration:1000,   //(optional) the auto rotation hold duration in milli seconds.  (number, default = SlideDuration*2)
     AutoStart:1000       //(optional) the auto rotation start duration in milli seconds. (number, default = no auto start)
    });
    
    
    S2=new zxcDIVSlideShow({
     Mode:'vertical',
     ID:'tstV',
     AutoStart:1000
    });
    
    /*]]>*/
    </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/

  6. #6
    Join Date
    May 2012
    Posts
    9

    Thumbs up

    Quote Originally Posted by vwphillips View Post
    can be used for Divs or images

    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[*/
    
    .parent {
      position:relative;left:200px;top:200px;width:200px;height:110px;border:solid red 1px;
    }
    
    .div {
      position:relative;width:200px;height:100px;background-Color:#FFFFCC;border:solid red 1px;float:left;
    }
    
    /*]]>*/
    </style></head>
    
    <body>
    
     <div id="tst" class="parent" onmouseover="S1.Pause();" onmouseout="S1.Auto();" >
      <div class="slide" >
       <div class="div" >0</div>
       <div class="div" >1</div>
       <div class="div" >2</div>
       <div class="div" >3</div>
      </div>
     </div>
    <input type="button" name="" value="Auto" onmouseup="S1.Auto();" />
    <input type="button" name="" value="Pause" onmouseup="S1.Pause();" />
    <input type="button" name="" value="Forward" onmouseup="S1.Step(-1);" />
    <input type="button" name="" value="Back" onmouseup="S1.Step(1);" />
     <div id="tstV" class="parent" onmouseover="S2.Pause();" onmouseout="S2.Auto();" style="left:800px;" >
      <div class="slide" >
       <div class="div" >0</div>
       <div class="div" >1</div>
       <div class="div" >2</div>
       <div class="div" >3</div>
      </div>
     </div>
    
    
    
    <script type="text/javascript">
    /*<![CDATA[*/
    // DIV Slide Show  (13-May-2012)
    // by Vic Phillips - http://www.vicsjavascripts.org.uk/
    
    function zxcDIVSlideShow(o){
     var oop=this,mde=o.Mode,mde=typeof(mde)=='string'&&mde.charAt(0).toUpperCase()=='V'?['top','left','height','offsetTop','offsetHeight']:['left','top','width','offsetLeft','offsetWidth'],p=document.getElementById(o.ID),slide=p.getElementsByTagName('DIV')[0],clds=slide.childNodes,ary=[],lft,sz,clode,ms=o.SlideDuration,hold=o.HoldDuration,srt=o.AutoStart,z0=0;
     p.style.overflow='hidden';
     slide.style.position='absolute';
     slide.style[mde[2]]='30000px';
     for (;z0<clds.length;z0++){
      if (clds[z0].nodeType==1){
       lft=clds[z0][mde[3]];
       ary.push(lft);
       sz=lft+clds[z0][mde[4]];
      }
     }
     slide.style[mde[2]]=sz+5+'px';
     clone=slide.cloneNode(true);
     clone.style[mde[1]]='0px';
     clone.style[mde[0]]=sz+'px';
     slide.appendChild(clone);
     clone=clone.cloneNode(true);
     clone.style[mde[0]]=-sz+'px';
     slide.appendChild(clone);
     oop.mde=mde[0];
     oop.obj=slide;
     oop.ary=ary;
     oop.sz=sz;
     oop.ms=typeof(ms)=='number'?ms:1000;
     oop.hold=typeof(hold)=='number'?hold:oop.ms*2;
     oop.cnt=0;
     oop.ud=-1;
     oop.now=0;
     if (typeof(srt)=='number'){
      oop.Auto(srt);
     }
    }
    
    zxcDIVSlideShow.prototype={
    
     Step:function(ud,auto){
      ud=typeof(ud)=='number'?ud>0?1:-1:-1;
      var oop=this,ary=oop.ary,cnt=this.cnt+ud;
      oop.Pause();
      if (typeof(ary[cnt])!='number'){
       oop.now+=oop.sz*(ud>0?-1:1);
       cnt=ud>0?0:ary.length-1;
      }
      oop.ud=ud;
      oop.auto=auto===true;
      oop.cnt=cnt;
      clearTimeout(oop.dly);
      oop.animate(oop.mde,oop.now,ary[cnt],new Date(),this.ms);
     },
    
     Auto:function(ms){
      var oop=this;
      oop.Pause();
      oop.to=setTimeout(function(){ oop.Step(oop.ud,true); },ms||500);
     },
    
     Pause:function(){
      this.auto=false;
      clearTimeout(this.to);
     },
    
     animate:function(mde,f,t,srt,mS){
      var oop=this,ms=new Date().getTime()-srt,now=(t-f)/mS*ms+f;
      if (isFinite(now)){
       oop.now=now;
       oop.obj.style[mde]=now+'px';
      }
      if (ms<mS){
       oop.dly=setTimeout(function(){ oop.animate(mde,f,t,srt,mS); },10);
      }
      else {
       oop.now=t;
       oop.obj.style[mde]=t+'px';
       if (oop.auto){
        oop.Auto(oop.hold);
       }
      }
     }
    
    }
    
    S1=new zxcDIVSlideShow({
     ID:'tst',            // the unique ID name of the parent node.                       (string)
     Mode:'horizontal',   //(optional) the mode of execution, 'horizontal' or 'vertical'. (string, default = 'horizontal')
     SlideDuration:1000,  //(optional) the slide duration in milli seconds.               (number, default = 1000)
     HoldDuration:1000,   //(optional) the auto rotation hold duration in milli seconds.  (number, default = SlideDuration*2)
     AutoStart:1000       //(optional) the auto rotation start duration in milli seconds. (number, default = no auto start)
    });
    
    
    S2=new zxcDIVSlideShow({
     Mode:'vertical',
     ID:'tstV',
     AutoStart:1000
    });
    
    /*]]>*/
    </script>
    </body>
    
    </html>
    man ! i'm seriously honored you provided me with this! if i was actually making money off my LLC i'd ask for your pay pal so i could compensate you in some way . thank you very much !

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles