Skip to content

Commit

Permalink
Added AMD Wrapper, fixes #266
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Oct 18, 2014
1 parent 7a0a0d2 commit 04cf612
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -41,3 +41,6 @@ build/.sizecache.json
node_modules
bower_components
.grunt

*.iml
.idea/
12 changes: 10 additions & 2 deletions bin/javascripts/jquery.nanoscroller.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/javascripts/jquery.nanoscroller.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/javascripts/jquery.nanoscroller.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/javascripts/jquery.nanoscroller.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 16 additions & 8 deletions coffeescripts/jquery.nanoscroller.coffee
Expand Up @@ -3,7 +3,17 @@
# @author James Florentino
# @contributor Krister Kari

(($, window, document) ->
((factory) ->
if typeof define is 'function' and define.amd
# AMD
define [
'jquery'
], ($) ->
factory($, window, document)
else
# Browser globals
factory(jQuery, window, document)
) ($, window, document) ->
"use strict"

# Default settings
Expand Down Expand Up @@ -409,12 +419,12 @@
@prevScrollTop = @contentScrollTop or 0
@contentScrollTop = content.scrollTop

direction = if @contentScrollTop > @previousPosition
direction = if @contentScrollTop > @previousPosition
"down"
else
if @contentScrollTop < @previousPosition
"up"
else
else
if @contentScrollTop < @previousPosition
"up"
else
"same"
@previousPosition = @contentScrollTop

Expand Down Expand Up @@ -835,5 +845,3 @@

$.fn.nanoScroller.Constructor = NanoScroll
return

)(jQuery, window, document)

0 comments on commit 04cf612

Please sign in to comment.