dragend icon indicating copy to clipboard operation
dragend copied to clipboard

Require.js

Open xystarbucks opened this issue 9 years ago • 3 comments

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

xystarbucks avatar Oct 27 '16 09:10 xystarbucks

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

alexiovay avatar Oct 27 '16 09:10 alexiovay

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
        });

xystarbucks avatar Oct 27 '16 09:10 xystarbucks

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.

alexiovay avatar Oct 27 '16 10:10 alexiovay