www.webdeveloper.com
Results 1 to 3 of 3

Thread: Suggestions..?

  1. #1
    Join Date
    Feb 2014
    Posts
    1

    Suggestions..?

    I have a website client that has a retail business and offers a specific and constant special for each day of the week. I thought to create a slider / slideshow which would loop and transition to the appropriate daily special image at midnight each day...for the seven days - which keeps me from having to change images manually each day. However, I am having difficulty finding any slideshow / slider software which has the ability to transition images at 24hr intervals. I have looked high and low to no avail. I am open for suggests which will point me in the proper direction.

    thanks

  2. #2
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,709
    This will chage the initial image an midnight(see red line)

    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>
    
    <base href="../StdImages/"  />
    
    <style type="text/css">
    
    .stepcarousel{
     position:relative; /* relative or absolute */
     border:1px solid black;
     width:220px; /* Width of Carousel */
     height:220px; /* Height of Carousel */
    }
    
    .stepcarousel .belt{
     position:absolute; /* script forces absolute*/
     text-Align:left;
     left:0px;
     top:0px;border:solid red 0px;
    }
    
    .stepcarousel .belt IMG {
     float:left;width:220px;height:220px;
    }
    
    #paginate {
     position:relative;width:270px;height:30px;border:1px solid black;
    }
    
    #paginate .page {
     position:relative;width:20px;height:20px;float:left;margin:5px;background-Color:#FFFFCC;border:solid red 1px;cursor:pointer;
    }
    
    #paginate .current {
     height:20px;background-Color:#FF0000;
    }
    
    </style>
    
    
    </head>
    
    <body>
    
    <input id="b1" type="button" name="" value="Next" />
    <input id="b2" type="button" name="" value="Back" />
    <input id="b3" type="button" name="" value="GoTo 0" onmouseup="zxcStepCarouselVII.GoTo('mygallery',0);"/>
    <input type="button" name="" value="GoTo 1" onmouseup="zxcStepCarouselVII.GoTo('mygallery',1);"/>
    <input type="button" name="" value="GoTo 2" onmouseup="zxcStepCarouselVII.GoTo('mygallery',2);"/>
    <input type="button" name="" value="GoTo 3" onmouseup="zxcStepCarouselVII.GoTo('mygallery',3);"/>
    <input type="button" name="" value="GoTo 4" onmouseup="zxcStepCarouselVII.GoTo('mygallery',4);"/>
    <input id="ip" />
     <div id="mygallery" class="stepcarousel">
    
      <div class="belt">
    
       <img src="http://www.vicsjavascripts.org/StdImages/0.gif" />
    
       <img src="http://www.vicsjavascripts.org/StdImages/1.gif" />
    
        <img src="http://www.vicsjavascripts.org/StdImages/2.gif" />
    
        <img src="http://www.vicsjavascripts.org/StdImages/3.gif" />
    
        <img src="http://www.vicsjavascripts.org/StdImages/4.gif" />
    
        <img src="http://www.vicsjavascripts.org/StdImages/5.gif" />
    
        <img src="http://www.vicsjavascripts.org/StdImages/6.gif" />
    
      </div>
    
     </div>
    
     <div id="paginate" ></div>
    
    
    <script type="text/javascript">
    /*<![CDATA[*/
    // Step Carousel VII (15-January-2014)
    // by Vic Phillips - http://www.vicsjavascripts.org/
    
    
    var zxcStepCarouselVII={
    
     Next:function(id,ud){
      var o=this['zxc'+id],ud=typeof(ud)=='number'&&ud>0?1:-1;
      if (o){
       o.ud=ud;
       this.rotate(o,o.n+ud);
       clearTimeout(o.to);
      }
     },
    
     GoTo:function(id,n){
      var o=this['zxc'+id],ud=typeof(ud)=='number'&&ud>0?1:-1;
      if (o){
       this.Pause(id);
       if (typeof(o.ary[n])=='number'&&n!=o.n&&!(n==0&&o.n==o.lgth)){
        n>o.n&&n!=0?1:-1;
        this.rotate(o,n);
       }
      }
     },
    
     Auto:function(id,ms){
      var oop=this,o=oop['zxc'+id];
      o?o.to=setTimeout(function(){ oop.rotate(o,true); },ms||200):null;
     },
    
     Pause:function(id){
      var o=this['zxc'+id];
      if (o){
       o.auto=false;
       clearTimeout(o.to);
      }
     },
    
     init:function(o){
      var id=o.CarouselID,m=o.Mode,ud=o.Direction,ms=o.Animate,h=o.AutoHold,srt=o.AutoStart,add=o.AddEvents,di=o.DisplayIndex,days=o.Persistence,p=document.getElementById(id),pag=document.getElementById(o.PaginateID),s=p?p.getElementsByTagName('DIV')[0]:null;
      if (s){
       var m=typeof(m)=='string'&&m.charAt(0).toUpperCase()=='V'?['top','left','height','offsetTop','offsetHeight','marginBottom']:['left','top','width','offsetLeft','offsetWidth','marginRight'];
       var days=(isFinite(days*1)&&days>0)||days=='session'?days:-1,ck=this.cookie(id),n=days!=-1&&ck?ck*1:di,clds=s.childNodes,pgs=pag?pag.childNodes:[],sz=0,c=0,pg,cls,mx,cc,z0=0,z1=0,z2=1,z3=0;
       o.pgs=[];
       for (;z0<pgs.length;z0++){
        if (pgs[z0].nodeType==1){
         o.pgs.push(pgs[z0]);
        }
       }
       s.style[m[2]]='30000px';
       m[0]=='left'?s.style.textAlign=m[0]:null;
       p.style.overflow='hidden';
       o.w=o.Wrap!==false;
       o.ary=[];
       for (;z1<clds.length;z1++){
        if (clds[z1].nodeType==1){
         clds[z1].style[m[5]]='0px';
         o.ary.push(clds[z1][m[3]]);
         sz=clds[z1][m[4]];
         pg=o.pgs[c]||document.createElement('DIV');
         !o.pgs[c]&&pag?pag.appendChild(pg):null;
         this.addevt(pg,'mouseup','GoTo',id,c);
         cls=pg.className;
         o.pgs[c]=[pg,cls+' page',cls+' page current'];
         pg.className=o.pgs[c][1];
         c++;
        }
       }
       sz+=(o.ary[c-1]);
       o.n=n>=0&&n<c?n:0;
       s.style[m[2]]=sz+10+'px';
       o.pgs[o.n][0].className=o.pgs[o.n][2];
       s.style[m[0]]=-sz+'px';
       if (o.w){
        o.ary.push(sz+o.ary[0]);
        mx=p[m[4]]+sz;
        c=s.cloneNode(true);
        while (sz<mx){
         cc=c.cloneNode(true);
         cc.style[m[0]]=sz+'px';
         cc.style[m[1]]='0px';
         s.appendChild(cc);
         sz+=sz;
        }
       }
       s.style[m[0]]=-o.ary[o.n]+'px';
       o.id=id;
       o.s=[s,m[0]];
       o.lgth=o.ary.length-1;
       o.ms=typeof(ms)=='number'&&ms>20?ms:1000;
       o.h=typeof(h)=='number'&&h>10?h:o.ms*4;
       o.ud=typeof(ud)=='number'&&ud<0?-1:1;
       o.days=isFinite(days*1)?days*1:days;
       o.rtn=typeof(o.OnStep)=='function'?o.OnStep:null;
       if (add instanceof Array){
        for (;z3<add.length;z3++){
         if (add[z3]){
          p=document.getElementById(add[z3][0]);
          if (p&&this[add[z3][2]]){
           s=add[z3][1];
           this.addevt(p,s=='click'||s=='mouseover'||s=='mouseout'||s=='mousedown'?s:'mouseup',add[z3][2],o.id,add[z3][3]);
           if (!o.w){
            add[z3][2]=='Next'&&add[z3][3]==1?o.nxt=p:null;
            add[z3][2]=='Next'&&add[z3][3]==-1?o.bak=p:null;
            this.nxt(o,n);
           }
          }
         }
        }
       }
       this['zxc'+id]=o;
       o.rtn?o.rtn(o,n):null;
       typeof(srt)=='number'&&srt>20?this.Auto(id,srt):null;
      }
     },
    
     rotate:function(o,a){
      this.Pause(o.id);
      o.auto=a===true;
      var n=o.auto?o.n+o.ud:a,f=-o.ary[o.n];
      if (o.w&&((n>o.lgth&&o.ud>0)||(n<0&&o.ud<0))){
       f=-o.ary[o.ud>0?0:o.lgth];
       n=o.ud>0?1:o.lgth-1;
      }
      if (n>=0&&n<=o.lgth){
       this.nxt(o,n);
       o.pgs[o.w&&o.n==o.lgth?0:o.n][0].className=o.pgs[o.w&&o.n==o.lgth?0:o.n][1];
       a=o.w&&n==o.lgth?0:n;
       o.pgs[a][0].className=o.pgs[a][2];
       this.animate(o,o.s,f,-o.ary[n],new Date(),o.ms);
       o.n=n;
       o.rtn?o.rtn(o,n):null;
       document.cookie=o.id+'='+a+(typeof(o.days)=='number'?';expires='+(new Date(new Date().getTime()+o.days*86400000).toGMTString())+';path/;':';');
      }
     },
    
     animate:function(o,a,f,t,srt,mS){
      clearTimeout(a[4]);
      var oop=this,ms=new Date()-srt,n=(t-f)/mS*ms+f;
      if (isFinite(n)){
       a[0].style[a[1]]=n+'px';
      }
      if (ms<mS){
       a[4]=setTimeout(function(){ oop.animate(o,a,f,t,srt,mS); },10);
      }
      else {
       a[3]=t;
       a[0].style[a[1]]=t+'px';
       o.auto?oop.Auto(o.id,o.h):null;
      }
     },
    
     nxt:function(o,n){
      o.nxt?o.nxt.style.opacity=n>=o.lgth?.5:1:null;
      o.bak?o.bak.style.opacity=n<=0?.5:1:null;
     },
    
     cookie:function(nme){
      var re=new RegExp(nme+'=[^;]+','i');
      return document.cookie.match(re)?document.cookie.match(re)[0].split("=")[1]:null;
     },
    
     addevt:function(o,t,f,p,p1){
      var oop=this;
      o.addEventListener?o.addEventListener(t,function(e){ return oop[f](p,p1);},false):o.attachEvent?o.attachEvent('on'+t,function(e){ return oop[f](p,p1); }):null;
     }
    
    
    }
    
    zxcStepCarouselVII.init({
     CarouselID:'mygallery', // the unique ID name of the carousel parent DIV.                    (string)
     Mode:'Horizontal',      //(optional) the display mode, 'Horizontal' or 'Vertical'.           (string, default = 'Horizontal')
     Animate:1000,           //(optional) the step duration in millisec.                          (number, minimum = 21, default = 1000)
     AutoHold:1000,          //(optional) the auto rotation 'hold' delay in millisec.             (number, minimum = 11, default = Animate*4)
    // AutoStart:2000,         //(optional) the auto rotation 'start' delay in millisec.            (number, minimum = 21, default = no auto start)
     DisplayIndex:new Date().getDay(),         //(optional) the index number of the initial panel to display.       (number, default = 0)
     Direction:1,            //(optional) the initial direction, >0 = anti-clock, <0 = clockwise. (number, default = 1 = anti-clockwise)
     Wrap:true,              //(optional) false = the carousel will not 'wrap' first to last.     (boolean, default = true = carousel will 'wrap' first to last)
     PaginateID:'paginate',  //(optional) the unique ID name of the paginate parent DIV.          (string, default = no pagination)
     AddEvents:[             //(optional) add event calls to page elements(see Script Functions). (array, default = in line event calls)
      // field 0 = the unique ID name of the element.
      // field 1 = the event type.
      // field 2 = the script function to call(see Controlling the Script).
      // field 3 = (optional) the value to pass to the function(see Controlling the Script).
      ['b1','mouseup','Next',1],
      ['b2','mouseup','Next',-1],
      ['b3','mouseup','GoTo',0],
      ['mygallery','mouseover','Pause'],
      ['mygallery','mouseout','Auto']
     ],
    // Persistence:'session',  //(optional) restore the last step position for the browser session. (string, default = no persistence)
    // Persistence:1,          //(optional) the number of days to restore the step position.        (number, default = no persistence)
     OnStep:function(o,i){   //(optional) a function to call on step.                             (function, default = no function)
      // i = the index number of the step
      var ip=document.getElementById('ip');
      ip?ip.value='Step '+i:null;
     }
    });
    
    /*]]>*/
    </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/

  3. #3
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,709
    or if you simply want to swap the image
    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>
    </head>
    
    <body>
       <a href="#" ><img id="myimage" src="http://www.vicsjavascripts.org/StdImages/0.gif" /></a>
    
    <script type="text/javascript">
    /*<![CDATA[*/
    
    var zxcDailyImage={
    
     init:function(op){
      var id=op.ImageID,ary=op.ImageArray,rf=op.Refresh,img=document.getElementById(id),d=new Date().getDay(),o=this['zxc'+id];
      if (img&&img.src&&!o&&ary instanceof Array&&ary.length==7){
       o=this['zxc'+id]=op;
       o.a=img.parentNode;
       typeof(rf)=='number'&&rf>0?setInterval(function(){ zxcDailyImage.init(op); },rf*60000):null;
      }
      if (o&&ary[d][0]&&img.src!=ary[d][0]){
       img.src=ary[d][0];
       o.a.removeAttribute('href');
       ary[d][1]?o.a.href=ary[d][1]:null;
      }
     }
    
    
    
    }
    
    zxcDailyImage.init({
     ImageID:'myimage',  // the unique ID name of the image.                                  (string)
     ImageArray:[        // an array defining the SRC and link HREF for each day of the week. (array)
      // field 0 = the image SRC.
      // field 1 = the image link HREF.
      ['http://www.vicsjavascripts.org/StdImages/0.gif',''],
      ['http://www.vicsjavascripts.org/StdImages/1.gif',''],
      ['http://www.vicsjavascripts.org/StdImages/2.gif',''],
      ['http://www.vicsjavascripts.org/StdImages/3.gif',''],
      ['http://www.vicsjavascripts.org/StdImages/4.gif',''],
      ['http://www.vicsjavascripts.org/StdImages/5.gif',''],
      ['http://www.vicsjavascripts.org/StdImages/6.gif','']
     ],
     Refresh:5        //(optional) The image refresh delay in minutes.                        (number, default = no refresh)
    });
    
    /*]]>*/
    </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/

Thread Information

Users Browsing this Thread

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

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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.13111 seconds
  • Memory Usage 2,876KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (3)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates