Results 1 to 3 of 3

Thread: Conveyor Belt slide show centering pop-up

  1. #1
    Join Date
    Aug 2009
    Posts
    39
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Conveyor Belt slide show centering pop-up

    1) Script Title: Conveyor Belt

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...rightslide.htm

    3) Describe problem: I have the conveyor belt working perfectly, with a link on each picture to open a pop-up window.
    However, I'm trying to have the pop-ups open centered in the middle of the page and at a specific size.
    Right now, they open in the upper right corner of the page in the specified size in Firefox, or as a whole page in IE
    Any suggestions on how I can get them to open centered and in the specified size in all (or at least most) Browsers?

    Any help would be greatly appreciated.

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

    Default

    this will provide a simple image centered popup for images with a class name 'popup'

    pay attention to the code in red

    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>
    <script type="text/javascript">
    
    /***********************************************
    * Conveyor belt slideshow script-  Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    
    //Specify the slider's width (in pixels)
    var sliderwidth="300px"
    //Specify the slider's height
    var sliderheight="150px"
    //Specify the slider's slide speed (larger is faster 1-10)
    var slidespeed=3
    //configure background color:
    slidebgcolor="#EAEAEA"
    
    //Specify the slider's images
    var leftrightslide=new Array()
    var finalslide=''
    leftrightslide[0]='<a href="http://www.vicsjavascripts.org/StdImages/WinterPalace.jpg"><img class="popup" src="http://www.vicsjavascripts.org/StdImages/1.gif" border=1></a>'
    leftrightslide[1]='<a href="http://www.vicsjavascripts.org/StdImages/2.gif"><img class="popup" src="http://www.vicsjavascripts.org/StdImages/2.gif" border=1></a>'
    leftrightslide[2]='<a href="http://www.vicsjavascripts.org/StdImages/3.gif"><img class="popup" src="http://www.vicsjavascripts.org/StdImages/3.gif" border=1></a>'
    leftrightslide[3]='<a href="http://www.vicsjavascripts.org/StdImages/4.gif"><img class="popup" src="http://www.vicsjavascripts.org/StdImages/4.gif" border=1></a>'
    leftrightslide[4]='<a href="http://www.vicsjavascripts.org/StdImages/5.gif"><img class="popup" src="http://www.vicsjavascripts.org/StdImages/5.gif" border=1></a>'
    
    //Specify gap between each image (use HTML):
    var imagegap=" "
    
    //Specify pixels gap between each slideshow rotation (use integer):
    var slideshowgap=5
    
    
    ////NO NEED TO EDIT BELOW THIS LINE////////////
    
    var copyspeed=slidespeed
    leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
    var iedom=document.all||document.getElementById
    if (iedom)
    document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
    var actualwidth=''
    var cross_slide, ns_slide
    
    function fillup(){
    if (iedom){
    cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
    cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
    cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
    actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
    cross_slide2.style.left=actualwidth+slideshowgap+"px"
    }
    else if (document.layers){
    ns_slide=document.ns_slidemenu.document.ns_slidemenu2
    ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
    ns_slide.document.write(leftrightslide)
    ns_slide.document.close()
    actualwidth=ns_slide.document.width
    ns_slide2.left=actualwidth+slideshowgap
    ns_slide2.document.write(leftrightslide)
    ns_slide2.document.close()
    }
    lefttime=setInterval("slideleft()",30)
    }
    
    function slideleft(){
    if (iedom){
    if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
    cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
    else
    cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"
    
    if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
    cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
    else
    cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"
    
    }
    else if (document.layers){
    if (ns_slide.left>(actualwidth*(-1)+8))
    ns_slide.left-=copyspeed
    else
    ns_slide.left=ns_slide2.left+actualwidth+slideshowgap
    
    if (ns_slide2.left>(actualwidth*(-1)+8))
    ns_slide2.left-=copyspeed
    else
    ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
    }
    }
    
    
    if (iedom||document.layers){
    with (document){
    document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
    if (iedom){
    write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
    write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">')
    write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
    write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
    write('</div></div>')
    }
    else if (document.layers){
    write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
    write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
    write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
    write('</ilayer>')
    }
    document.write('</td></table>')
    }
    }
    
    function zxcImagePopUp(cls){
     var imgs=document.getElementsByTagName('IMG'),p,i=document.createElement('IMG'),mk=document.createElement('DIV'),ary=[],z0=0;
     i.style.position='fixed';
     i.style.zIndex='101';
     i.style.cursor='pointer';
     i.style.left=i.style.top='-30000px';
     document.body.appendChild(i);
     mk.style.position='fixed';
     mk.style.bottom=mk.style.right=mk.style.width=mk.style.height='0px';
     document.body.appendChild(mk);
     for (var z0=0;z0<imgs.length;z0++){
      if ((' '+imgs[z0].className+' ').indexOf(' '+cls+' ')>=0){
       p=imgs[z0].parentNode;
       ary=[imgs[z0],p.href||imgs[z0]];
       this.addevt(p,'click','rtn');
       this.addevt(imgs[z0],'click','pop',[imgs[z0],p.href||imgs[z0]]);
      }
     }
     this.addevt(document,'click','close');
     this.i=i;
     this.mk=mk;
    }
    
    zxcImagePopUp.prototype={
    
     pop:function(a){
      this.close();
      var n=new Image();
      this.n=n;
      this.i.src=n.src=a[1];
      this.load(this,n,true);
     },
    
     load:function(oop,n,d){
      clearTimeout(oop.to);
      if (n.width<40||d){
       return oop.to=setTimeout(function(){ oop.load(oop,n); },200);
      }
      this.ud=true;
      this.open();
     },
    
     open:function(){
      if (this.ud){
       this.i.style.left=(this.mk.offsetLeft-this.n.width)/2+'px';
       this.i.style.top=(this.mk.offsetTop-this.n.height)/2+'px';
      }
     },
    
     close:function(){
      this.i.style.left=this.i.style.top='-30000px';
      this.ud=false;
     },
    
     rtn:function(){
      return false;
     },
    
     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;
     }
    
    
    }
    
    
    window.onload=function(){
     fillup();
     new zxcImagePopUp('popup');
    }
    
    </script>
    
    <p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br>
    <a href="http://dynamicdrive.com">Dynamic Drive</a></font></p>
    </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
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    few more features

    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>
    <script type="text/javascript">
    
    /***********************************************
    * Conveyor belt slideshow script-  Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    
    //Specify the slider's width (in pixels)
    var sliderwidth="300px"
    //Specify the slider's height
    var sliderheight="150px"
    //Specify the slider's slide speed (larger is faster 1-10)
    var slidespeed=3
    //configure background color:
    slidebgcolor="#EAEAEA"
    
    //Specify the slider's images
    var leftrightslide=new Array()
    var finalslide=''
    leftrightslide[0]='<a href="http://www.vicsjavascripts.org/StdImages/WinterPalace.jpg"><img class="popup mode:clip millsec:5000" src="http://www.vicsjavascripts.org/StdImages/1.gif" border=1></a>'
    leftrightslide[1]='<a href="http://www.vicsjavascripts.org/StdImages/2.gif"><img class="popup mode:fade" src="http://www.vicsjavascripts.org/StdImages/2.gif" border=1></a>'
    leftrightslide[2]='<a href="http://www.vicsjavascripts.org/StdImages/3.gif"><img class="popup mode:clip width:400 height:400" src="http://www.vicsjavascripts.org/StdImages/3.gif" border=1></a>'
    leftrightslide[3]='<a href="http://www.vicsjavascripts.org/StdImages/4.gif"><img class="popup width:400 height:400" src="http://www.vicsjavascripts.org/StdImages/4.gif" border=1></a>'
    leftrightslide[4]='<a href="http://www.vicsjavascripts.org/StdImages/5.gif"><img class="popup width:400 height:600" src="http://www.vicsjavascripts.org/StdImages/5.gif" border=1></a>'
    
    //Specify gap between each image (use HTML):
    var imagegap=" "
    
    //Specify pixels gap between each slideshow rotation (use integer):
    var slideshowgap=5
    
    
    ////NO NEED TO EDIT BELOW THIS LINE////////////
    
    var copyspeed=slidespeed
    leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
    var iedom=document.all||document.getElementById
    if (iedom)
    document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
    var actualwidth=''
    var cross_slide, ns_slide
    
    function fillup(){
    if (iedom){
    cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
    cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
    cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
    actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
    cross_slide2.style.left=actualwidth+slideshowgap+"px"
    }
    else if (document.layers){
    ns_slide=document.ns_slidemenu.document.ns_slidemenu2
    ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
    ns_slide.document.write(leftrightslide)
    ns_slide.document.close()
    actualwidth=ns_slide.document.width
    ns_slide2.left=actualwidth+slideshowgap
    ns_slide2.document.write(leftrightslide)
    ns_slide2.document.close()
    }
    lefttime=setInterval("slideleft()",30)
    }
    
    function slideleft(){
    if (iedom){
    if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
    cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
    else
    cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"
    
    if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
    cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
    else
    cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"
    
    }
    else if (document.layers){
    if (ns_slide.left>(actualwidth*(-1)+8))
    ns_slide.left-=copyspeed
    else
    ns_slide.left=ns_slide2.left+actualwidth+slideshowgap
    
    if (ns_slide2.left>(actualwidth*(-1)+8))
    ns_slide2.left-=copyspeed
    else
    ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
    }
    }
    
    
    if (iedom||document.layers){
    with (document){
    document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
    if (iedom){
    write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
    write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">')
    write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
    write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
    write('</div></div>')
    }
    else if (document.layers){
    write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
    write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
    write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
    write('</ilayer>')
    }
    document.write('</td></table>')
    }
    }
    
    function zxcImagePopUp(cls){
     var imgs=document.getElementsByTagName('IMG'),p,img=document.createElement('IMG'),mk=document.createElement('DIV'),s,o,i,z0=0,z0a;
     img.style.position='fixed';
     img.style.zIndex='101';
     img.style.cursor='pointer';
     img.style.left=img.style.top='-30000px';
     document.body.appendChild(img);
     mk.style.position='fixed';
     mk.style.bottom=mk.style.right=mk.style.width=mk.style.height='0px';
     document.body.appendChild(mk);
     for (var z0=0;z0<imgs.length;z0++){
      if ((' '+imgs[z0].className+' ').indexOf(' '+cls+' ')>=0){
       p=imgs[z0].parentNode;
       o={img:imgs[z0],src:p.href||imgs[z0].src};
       s=imgs[z0].className.split(' ');
       for (z0a=0;z0a<s.length;z0a++){
        i=s[z0a].indexOf(':');
        if (i>0){
         o[s[z0a].slice(0,i).toLowerCase()]=s[z0a].slice(i+1);
        }
       }
       this.addevt(p,'click','rtn');
       this.addevt(imgs[z0],'click','pop',o);
      }
     }
     this.addevt(document,'click','close');
     this.i=img;
     this.mk=mk;
     this.a=[img,'',[]];
    }
    
    zxcImagePopUp.prototype={
    
     pop:function(o){
      this.close();
      this.o=o;
      o.n=new Image();
      this.i.src=o.n.src=o.src;
      this.load(this,o,true);
     },
    
     load:function(oop,o,d){
      clearTimeout(oop.to);
      if (o.n.width<40||d){
       return oop.to=setTimeout(function(){ oop.load(oop,o); },200);
      }
      this.ud=true;
      this.open();
     },
    
     open:function(){
      if (this.ud){
       var o=this,m=o.o.mode,ms=o.o.millsec,w=o.o.width,w=isFinite(w*1)&&w>0?w*1:o.o.n.width,h=o.o.height,h=isFinite(h*1)&&h>0?h*1:o.o.n.height;
       o.i.style.clip='rect(0px,'+w+'px,'+h+'px,0px)';
       o.a[1]=typeof(m)=='string'&&m.charAt(0).toUpperCase()=='C'?'clip':''
       o.animate(o.o,o.a,o.a[1]==''?[0]:[h/2,w/2,h/2,w/2],o.a[1]==''?[100]:[0,w,h,0],new Date(),isFinite(ms*1)&&ms>0?ms*1:1000);
       o.i.style.width=w+'px';
       o.i.style.height=h+'px';
       o.i.style.left=(o.mk.offsetLeft-w)/2+'px';
       o.i.style.top=(o.mk.offsetTop-h)/2+'px';
      }
     },
    
     close:function(){
      this.i.style.left=this.i.style.top='-30000px';
      this.ud=false;
     },
    
     animate:function(o,a,f,t,srt,mS){
      clearTimeout(a[7]);
      var oop=this,ms=new Date()-srt,n,z0=0;
      for (;z0<t.length;z0++){
       n=(t[z0]-f[z0])/mS*ms+f[z0];
       a[2][z0]=Math.max(Math.round(isFinite(n)?n:a[2][z0]),0);
      }
      oop.cng(a,a[2]);
      if (ms<mS){
       a[7]=setTimeout(function(){ oop.animate(o,a,f,t,srt,mS); },10);
      }
      else {
       oop.cng(a,t);
      }
     },
    
     cng:function(a,t){
      a[1]=='clip'?a[0].style.clip='rect('+t[0]+'px,'+t[1]+'px,'+t[2]+'px,'+t[3]+'px)':this.opc(a[0],t[0]);
     },
    
     opc:function(o,t){
      o.style.filter='alpha(opacity='+t+')';
      o.style.opacity=o.style.MozOpacity=o.style.WebkitOpacity=o.style.KhtmlOpacity=t/100-.001;
     },
    
     rtn:function(){
      return false;
     },
    
     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;
     }
    
    
    }
    
    
    window.onload=function(){
     fillup();
     new zxcImagePopUp('popup');
    }
    
    </script>
    
    <p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br>
    <a href="http://dynamicdrive.com">Dynamic Drive</a></font></p>
    </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/

Similar Threads

  1. Conveyor Belt slide show.
    By drmxms in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 01-14-2010, 06:04 PM
  2. help with Conveyor Belt Slide Show
    By asiatic in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 12-17-2009, 04:24 AM
  3. Conveyor belt slide show
    By NightPig in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 07-23-2008, 09:51 AM
  4. conveyor belt slide show
    By bennyy in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 10-25-2006, 06:47 AM
  5. conveyor belt slide show
    By robby136 in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 08-11-2005, 04:41 PM

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
  •