Skip to content

Instantly share code, notes, and snippets.

@collin
Created November 19, 2008 08:14
Show Gist options
  • Save collin/26455 to your computer and use it in GitHub Desktop.
Save collin/26455 to your computer and use it in GitHub Desktop.
require 'redshift'
class JQuery < Array
def initialize selector
@els = Document[selector]
end
def each &block
@els.each &block
return this
end
def hide
each{|el| el.styles[:display] = 'none' }
end
def show
each{|el| l.styles[:display] = '' }
end
end
def q selector, &block
JQuery.new selector, &block
end
Document.ready? do
q('.fields > li').hide
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment