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

9 lines
220 B
CoffeeScript
Raw Normal View History

2012-09-17 08:25:38 +00:00
$.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