1
0
Fork 0
beathaven/lib/assets/javascripts/jquery.neighbour.js.coffee

9 lines
220 B
CoffeeScript

$.fn.neighbour = (context, offset) ->
self = this[0]
result = null
nodes = $(context)
nodes.each (i, node) ->
result = nodes[i+offset] if node is self
result = null if typeof result is "undefined"
result