简体   繁体   中英

fade in and out from right to left

I am trying to fadeIn from left to right and right to left to make something like this:

在此处输入图片说明

this is my code, but this doesn't work:

$(lastSlide).animate({ width: 'toggle', height:'340', opacity: 'toggle' }, "slow");

this is what I get:

在此处输入图片说明

The problem is that you get the distortion by reducing the width of the image. Try to wrap the image in the div:

<div id="main">
  <div id="img1">
    <img src="..."/>
  </div>
  <div id="img2">
    <img src="..."/>
  </div>
 </div>

 $("#img2").animate({ width: 'toggle', height:'340', opacity: 'toggle' }, "slow");

Simple example: https://jsfiddle.net/12x4cauv/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM