specious / cloud9carousel

:cyclone: 3D-perspective carousel for jQuery / Zepto
http://j.mp/cloud9demo
233 stars 88 forks source link

event.preventDefault for carousel items NOT in front got lost #3

Closed wikipeter closed 8 years ago

wikipeter commented 9 years ago

Hello Ildar,

i noticed that while you refactored the cloud-carousel lib and made this smoothly running plugin, the event.preventDefault for items "which are going to be brought to front" got lost.

if(diff!=0)
 event.preventDefault();

is missing after Line 311 of jquery.cloud9carousel.js in .gh-pages branch.

Old cloud-carousel containing certain feature: https://gist.github.com/wikipeter/12bdeaef9dbf75e28350#file-cloud-carousel-1-0-5-min-js-L160

My Problem is: I have a project where all items are linked to somewhere else, which, if clicked, perform some rotation animation but then make the browser load the target page rather than finish the animation.

Any chance to get this included? I added those lines, and the behaviour from cloud-carousel was restored.

specious commented 8 years ago

@wikipeter, thank you for pointing this out. I agree, it is annoying when you click an item in the back, and the default action executes at the same time as it begins rotating it to the front.

I have modified the code so that the default action is allowed only if the clicked item is roughly in front already: https://github.com/specious/cloud9carousel/commit/de9c273e2c591e6b21610751983fe3f9a0113966#diff-af44906d52f0de98d63fafcd2d81b614R317