Stereobit / dragend

dragend JS – a touch ready, full responsive, content swipe script
http://stereobit.github.com/dragend/
MIT License
485 stars 114 forks source link

Require.js #90

Open xystarbucks opened 7 years ago

xystarbucks commented 7 years ago

How do I get dragend to work with Require.js.

If I enable require.js in my page, I will get dragend is not a function(…) error.

I think the problem is caused by the '$' symbol.

Thanks

alexiovay commented 7 years ago

Dragend is for Jquery, you have to implement jquery first. $ is Jquery related.

xystarbucks commented 7 years ago

It says on the main page of dragend: dragend.js is a touch ready, full responsive, content swipe script. It has no dependencies but it can, don't has to, used as a jQuery plugin.

Doesn't this means that it can be used without jQuery? I've checked the source code for this demo page: http://stereobit.github.io/dragend/demos/simple/ It doesn't load any jQuery.

The line that's causing the error is this:

$("#demo").dragend({
          scrollToPage: page
        });

Is there anyway to write the above in pure javasript. I've tried the following, but it doesn't work

document.getElementById("demo").dragend({
          scrollToPage: page
        });
alexiovay commented 7 years ago

As far as I remember it was optimized for Jquery and the original pure JS code comes from "hammer.js": http://hammerjs.github.io/

You can try to use this instead? I think it's pretty much the same but hammer.js is just pure javascript.