Results 1 to 3 of 3

Thread: How to add mouseover to Presentation Slideshow script

  1. #1
    Join Date
    Nov 2013
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default How to add mouseover to Presentation Slideshow script

    1) Script Title: Presentation Slideshow

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

    3) Describe problem: I love this script & want to use it, but I'd like to add a "mouseover" event that pauses the slide when the mouse hovers over it. Also, when none of the slides are linked, it does not work. Why is that? My page is http://www.anasigns.biz/vehicles.shtml. I have linked all the slides to themselves but would rather just have a mouseover event. I know very little about java script.
    Thanks.
    Last edited by jscheuer1; 11-27-2013 at 02:35 PM. Reason: Format

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,070
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Use this edited version of the script:

    Code:
    <script language="JavaScript1.2">
    
    //Presentational Slideshow Script- By Dynamic Drive
    //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
    //This credit MUST stay intact for legal use
    
    //Add the script where the slideshow should appear.
    
    var slideshow_width='600px' //SET SLIDESHOW WIDTH (set to largest image's width if multiple dimensions exist)
    var slideshow_height='350px' //SET SLIDESHOW HEIGHT (set to largest image's height if multiple dimensions exist)
    var pause=1000 //SET PAUSE BETWEEN SLIDE (2000=2 seconds)
    var slidebgcolor="fff"
    
    
    var dropimages=new Array()
    //SET IMAGE PATHS. Extend or contract array as needed
    dropimages[0]="Vehicles/V1.jpg"
    dropimages[1]="Vehicles/V2.jpg"
    dropimages[2]="Vehicles/V3.jpg"
    dropimages[3]="Vehicles/V4.jpg"
    dropimages[4]="Vehicles/V5.jpg"
    dropimages[5]="Vehicles/V6.jpg"
    dropimages[6]="Vehicles/V7.jpg"
    dropimages[7]="Vehicles/V8.jpg"
    dropimages[8]="Vehicles/V9.jpg"
    
    var droplinks=new Array()
    //SET IMAGE URLs. Use "" if you wish particular image to NOT be linked:
    droplinks[0]=""
    droplinks[1]=""
    droplinks[2]=""
    droplinks[3]=""
    droplinks[4]=""
    droplinks[5]=""
    droplinks[6]=""
    droplinks[7]=""
    droplinks[8]=""
    
    
    ////NO need to edit beyond here/////////////
    
    var preloadedimages=new Array()
    for (p=0;p<dropimages.length;p++){
    preloadedimages[p]=new Image()
    preloadedimages[p].src=dropimages[p]
    }
    
    var ie4=document.all
    var dom=document.getElementById
    
    if (ie4||dom)
    document.write('<div onmouseover="rotateimage.pause = true;" onmouseout="rotateimage.pause = false;" style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';background-color:'+slidebgcolor+';left:-'+slideshow_width+'"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';background-color:'+slidebgcolor+';left:-'+slideshow_width+'"></div></div>')
    else
    document.write('<a href="javascript:rotatelink()"><img name="defaultslide" src="'+dropimages[0]+'" border=0></a>')
    
    var curpos=parseInt(slideshow_width)*(-1)
    var degree=10
    var curcanvas="canvas0"
    var curimageindex=linkindex=0
    var nextimageindex=1
    
    function movepic(){
    if (curpos<0){
    curpos=Math.min(curpos+degree,0)
    tempobj.style.left=curpos+"px"
    }
    else{
    
    clearInterval(dropslide)
    nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
    tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
    var slideimage='<img src="'+dropimages[curimageindex]+'" border=0>'
    tempobj.innerHTML=(droplinks[curimageindex]!="")? '<a href="'+droplinks[curimageindex]+'" target="_blank">'+slideimage+'</a>' : slideimage
    nextimageindex=(nextimageindex<dropimages.length-1)? nextimageindex+1 : 0
    setTimeout("rotateimage()",pause)
    }
    }
    
    function rotateimage(){
    if(rotateimage.pause){
    setTimeout(rotateimage, pause);
    return;
    }
    if (ie4||dom){
    resetit(curcanvas)
    var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
    crossobj.style.zIndex++
    var temp='setInterval("movepic()",50)'
    
    dropslide=eval(temp)
    curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
    }
    else
    document.images.defaultslide.src=dropimages[curimageindex]
    linkindex=curimageindex
    curimageindex=(curimageindex<dropimages.length-1)? curimageindex+1 : 0
    }
    
    function rotatelink(){
    if (droplinks[linkindex]!="")
    window.open(droplinks[linkindex])
    }
    
    function resetit(what){
    curpos=parseInt(slideshow_width)*(-1)
    var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
    crossobj.style.left=curpos+"px"
    }
    
    function startit(){
    var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
    crossobj.innerHTML='<img src="'+dropimages[curimageindex]+'" border=0>'
    rotateimage()
    }
    
    if (ie4||dom)
    window.onload=startit
    else
    setInterval("rotateimage()",pause)
    </script>
    The browser cache may need to be cleared and/or the page refreshed to see changes.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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

    rmather (12-04-2013)

  4. #3
    Join Date
    Nov 2013
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks so much! This works great!
    Ruth

Similar Threads

  1. Slideshow 2! Stream and animate the presentation of images
    By rloaderro in forum Submit a DHTML or CSS code
    Replies: 4
    Last Post: 09-01-2008, 06:41 AM
  2. Presentation Slideshow Script
    By candyceh in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 06-26-2008, 10:04 PM
  3. Flash Presentation
    By gilanibusiness in forum Flash
    Replies: 1
    Last Post: 04-13-2007, 03:42 PM
  4. Presentation Slideshow Script
    By tghhampton in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 12-09-2006, 05:26 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
  •