ReferenceError: exports is not defined in scrollability.js | exports.directions = directions; #37

Open
jamshoo opened this Issue Jan 18, 2013 · 5 comments

2 participants

@jamshoo

//It seems scrollability hasn't been updated in a while, if you are using dropkick and jquery //this is what I had to do, edit on your scrollability.js file the following:

//Replace:
require.ready(function() {
document.addEventListener(isTouch ? 'touchstart' : 'mousedown', onTouchStart, false);
window.addEventListener('load', onLoad, false);
});

//For this:

$(document).ready(function(){
document.addEventListener(isTouch ? 'touchstart' : 'mousedown', onTouchStart, false);
window.addEventListener('load', onLoad, false);
});

and comment out line 77, 79 and 84 that start with 'export'.

@vicky8987

Although I changed these lines, then too i am getting error
I want to add this code for dropkick scroll in mobile device.
fro reference: http://23.23.201.202/vikas/ds/ex.html
In mobile i am able to see only 8 items out of 30 without scroll.

http://stackoverflow.com/questions/13388821/dropkick-plugin-not-wroking-with-scrollability-mobile-scrolling

Please verify the code:

//exports.directions = directions;

//exports.flashIndicators = function() {
// var scrollables = document.querySelectorAll('.scrollable.vertical');
// for (var i = 0; i < scrollables.length; ++i) {
// exports.scrollTo(scrollables[i], 0, 0, 20, true);
// }

//}

function onLoad() {
var ss = document.createElement("style");
document.head.appendChild(ss);
globalStyleSheet = document.styleSheets[document.styleSheets.length-1];

// exports.flashIndicators();

}

//require.ready(function() {
document.addEventListener(isTouch ? 'touchstart' : 'mousedown', onTouchStart, false);
window.addEventListener('load', onLoad, false);

//});

I commented
1-> //exports.directions = directions;
2-> //exports.flashIndicators = function() {
and finally
3-> //require.ready(function() {

If not commenting getting error
1->ReferenceError: exports is not defined
exports.directions = directions;
2->ReferenceError: require is not defined
require.ready(function() {

I am use this with dropkick.js.

If there is any suggestion or link. Please help.

@jamshoo

Here is my scrollability.js file download and replace it with yours
http://www.mediafire.com/?lpcuxuh49eecg75

@vicky8987

Thanks Jamshoo, but problem still exist in mobile phones for dropkick.
http://23.23.201.202/vikas/ds/ex.html

@jamshoo

I know it gives scroll problem on android but correctly works for iphone

@vicky8987

Thanks alot jamshoo, your JS is working fine for iphone. and behaving abnormally with android as told by you. but if any chance, you can suggest something to do better for android. Thank in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment