星空网 > 软件开发 > Java

网页常用动态效果

关键在于设定开关标识,父盒子固定定位,按钮盒子绝对定位超出父盒子部分

html代码:

<div>
  <img src='/images/loading.gif' data-original="images/qq.jpg" height="311" width="131" >
  <span><img src='/images/loading.gif' data-original="images/qqL.jpg" height="117" width="29" ></span>
</div>

CSS代码:

div{
  width:131px;
  height:311px;
  background: lightseagreen;
  position: fixed;
  right:-131px;
  top:50%;
  margin-top:-155px;
}
div span{
  position: absolute;
  left:-29px;
  top:50%;
  cursor: pointer;
  margin-top:-58px;
}

JQ代码:

<script>$(function(){//开关按钮,有两个状态,首先有一个初始状态  var flag=1;  $('div span').on('click',function(){  if(flag==1){    $(this).parent().animate({right:0},500);    $(this).children('img').attr('src','images/qqLOpen.jpg');    flag=0;  }else if(flag==0){    $(this).parent().animate({right:-131},500);    $(this).children('img').attr('src','images/qqL.jpg');    flag=1;    }  })})</script>        

 




原标题:网页常用动态效果

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

将产品图注册成美国图形商标:https://www.kjdsnews.com/a/1695263.html
阿里巴巴集团CEO吴泳铭兼任淘天集团CEO:https://www.kjdsnews.com/a/1695264.html
卖家福利!eBay加拿大站运费折扣延长至2024年3月31日!:https://www.kjdsnews.com/a/1695265.html
卖家必看!eBay物品刊登8大更新,销售体验更便捷高效:https://www.kjdsnews.com/a/1695266.html
2024中国数字营销趋势报告:https://www.kjdsnews.com/a/1695267.html
eBay英国站物流政策更新!lisitng页面也有重大调整!:https://www.kjdsnews.com/a/1695268.html
怪物在游轮上复活的电影 怪物在游轮上复活的电影叫什么:https://www.vstour.cn/a/411230.html
在线旅游如何选择更优惠的旅游产品?:https://www.vstour.cn/a/411231.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流