Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加入购物车时页面会自动滚到顶部 #13

Open
IrvingW opened this issue May 27, 2017 · 1 comment
Open

加入购物车时页面会自动滚到顶部 #13

IrvingW opened this issue May 27, 2017 · 1 comment

Comments

@IrvingW
Copy link

IrvingW commented May 27, 2017

如题,不知道该怎么解决
我的代码

$(".addcar").click(function(event){ 
 	var offset = $("#end").offset(); 
     var addcar = $(this); 
     var img = addcar.parent().find('img').attr('src'); 
     var flyer = $('<img class="u-flyer" src="'+img+'">'); 
     $ (window).unbind ('scroll');
     flyer.fly({ 
         start: { 
             left: event.pageX, //开始位置(必填)#fly元素会被设置成position: fixed 
             top: event.pageY //开始位置(必填) 
         }, 
         end: { 
             left: offset.left+10, //结束位置(必填) 
             top: offset.top+10, //结束位置(必填) 
             width: 0, //结束时宽度 
             height: 0 //结束时高度 
         }, 
         onEnd: function(){ //结束回调 
             $("#msg").show().animate({width: '250px'}, 200).fadeOut(1000); //提示信息 
 			
         } 
     }); 
 }); 
@joleye
Copy link

joleye commented Oct 12, 2018

addcar 是a标签吧,href属性改为:javascript:;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants