微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

jQuery实现360°全景拖动展示

CSS

代码如下:
normal 50px Arial;color:#fff;} #demo{left:50%;top:50%;margin-left:-512px;margin-top:-384px;width:1024px;height:768px;} #demo img{border-radius:8px;border:5px solid #555;} .back{font-size:18px;line-height:130%;padding:8px 20px;color:#fff;} #back-home{left:0px;top:0px;background:#35916D;} #back-article{right:0px;top:0px;background:#444;} #back-download{right:0px;bottom:0px;background:#CE565D;}

HTML

代码如下:

js

代码如下:

drag.js

代码如下:
unitStep){ if(mmx-mdx>0){ current=current+1; }else{ current=current-1; } mdx=mmx; if(current<0)current=length-1; if(current>length-1)current=0; that.attr("src",images[current]); } } }).on('touchend',function(e){ isDrag=false; }); //拖动 that.on('mousedown',function(e){ mdx=e.pageX; isDrag=true; }).on('mousemove',function(e){ mmx=e.pageX; if(isDrag){ if(Math.abs(mmx-mdx)>unitStep){ current=current+(mmx-mdx>0?1:-1); mdx=mmx; if(current<0)current=length-1; if(current>length-1)current=0; that.attr("src",images[current]); } } return false; }) $(document).on('mouseup',function(e){ isDrag=false; }); $(document).on('mouseleave',function(e){ isDrag=false; }); return this; }; })(jQuery);

以上所述就是本文的全部内容了,希望大家能够喜欢。

原文地址:https://www.jb51.cc/jquery/55201.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐