[英]easing an onclick function with element
I am new to js and jquery, but I can not figure this out, 我是js和jquery的新手,但我无法弄清楚这一点,
lets say i have a div with a id prev
. 可以说我有一个id为prev
的div。
My javascript looks like this: 我的JavaScript看起来像这样:
$('#prev').on('click', view.handPrevClick);
I animating divs with tween lite(that is what the handprevclick
function is for), but when u initially click on prev
, it doesnt animate. 我使用补间lite(这是handprevclick
函数的作用)为div动画,但是当您最初单击prev
,它没有动画。
how do I add an animate or time to slow down when on click? 单击时如何添加动画或时间以减慢速度?
I tried something like this 我尝试过这样的事情
$('#prev').on('click', view.handPrevClick.animate({duration: 'slow', easing: 'easeOutBack'}));
but that's not working? 但这不起作用吗?
if it is a class you need to change your code to: 如果是一类,则需要将代码更改为:
$('.prev').on('click', view.handPrevClick.animate({duration: 'slow', easing: 'easeOutBack'}));
The pound sign - '#prev'
you were using before prev is for id's, for classes you use '.prev'
英镑符号- '#prev'
你上一个之前使用于ID的,上课使用'.prev'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.