简体   繁体   中英

easing an onclick function with element

I am new to js and jquery, but I can not figure this out,

lets say i have a div with a id prev .

My javascript looks like this:

$('#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.

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM