Skip to main content
This topic has been closed for replies.
Correct answer Nancy OShea

I have no use for those outdated MM rollover behaviors.  I'm kind of surprised DW hasn't deprecated them.

You can do exactly what you want with CSS.  But keep in mind that touch devices don't have a mouse so hover effects don't do anything.

Swap Image on Hover - With CSS

1 reply

Nancy OShea
Community Expert
Community Expert
July 17, 2018

Which snippet are you talking about?

Please show us your code.

Nancy O'Shea— Product User & Community Expert
Participating Frequently
July 17, 2018

<a href="#" onMouseOut="MM_swapImgRestore()"     onMouseOver="MM_swapImage('porsche_356','','assets/porsche_356_sabbiatura_dopo_300x200.jpg',1)">

<img src="assets/porsche_356_sabbiatura_prima_300x200.jpg" alt="" width="300" height="200" class="img-lavorazioni" id="porsche_356"></a>

<script>

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a.indexOf("#")!=0){ d.MM_p=new Image; d.MM_p[j++].src=a;}}

}

function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d)&&d.all) x=d.all; for (i=0;!x&&i<d.forms.length;i++) x=d.forms;

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}

function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

</script>

this is the test published:

https://alessiopaolettidesign.it/sabbiaturapg/

Nancy OShea
Community Expert
Nancy OSheaCommunity ExpertCorrect answer
Community Expert
July 17, 2018

I have no use for those outdated MM rollover behaviors.  I'm kind of surprised DW hasn't deprecated them.

You can do exactly what you want with CSS.  But keep in mind that touch devices don't have a mouse so hover effects don't do anything.

Swap Image on Hover - With CSS

Nancy O'Shea— Product User & Community Expert