鼠标移到到图片,图片向上滑动预览效果

37 篇文章 0 订阅
<!DOCTYPE html>
<html>
<head>
	<title>鼠标移到到图片,图片向上滑动预览效果</title>
	<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
	<script type="text/javascript">
	//图片滚动
	$(document).ready(function(){
	  function template($this,img_h,info_h){
	    function img1_sin(){
	      $this.find(".img1").find("img").stop(true,true).animate({
	        top: -(img_h-info_h)
	      },(img_h-info_h)*4,"linear")
	    }
	    img1_sin();
	  }
	  $(".slide").mouseover(function(){

	    var info_h = $(this).find(".img1").find(".info").height();
	    var img_h = $(this).find(".img1").find("img").height();
	    template($(this),img_h,info_h);
	  })
	  $(".slide").mouseout(function(){
	    $(this).find(".img1").find("img").stop(true,true).animate({
	      top: 0
	    }, 800 , "linear");
	  })
	})
	</script>
	<style type="text/css">
	  .img1{
	    width: 305px;
	    height: 206px;
	    padding: 12px 1px 1px;
	    -webkit-transition: all .3s;
	    transition: all .3s;
	    position: relative;
	  }
	  .info{    
	    overflow: hidden;
	    height: 100%;
	    position: relative;
	  }
	  .slide img{
	    max-height: inherit;
	    *max-height: none;
	    position: absolute;
	    top: 0;
	  }
	</style>
</head>
<body>
	<div class="slide" style="width:330px;">
        <div class="img1" style="margin-left:15px;">
          <div class="info">
            <a href="" target="_blank"><img src="http://www.hunuoyun.com/upload/product/1811/201811225424.png" width="305" alt=""></a>
          </div>
        </div>
    </div>
</body>
</html>
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

每天都进步一点点

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值