Skip to content

Instantly share code, notes, and snippets.

@joselo
Created November 14, 2012 20:40
Show Gist options
  • Save joselo/4074646 to your computer and use it in GitHub Desktop.
Save joselo/4074646 to your computer and use it in GitHub Desktop.
simple toggle sidebar
(($) ->
$.fn.sidebar = (options) ->
that = this
settings = $.extend(options)
toggle_link = $(settings.toggle_link)
main_content = $(settings.main_content)
width = $(that).css('width')
setup = ->
$(that).hide()
toggle_link.click (e) ->
e.preventDefault()
$(that).toggle()
if $(that).css('display') == 'block'
main_content.css 'margin-left', width
else
main_content.css 'margin-left', 0
mustang_dynamic_select = setup()
) jQuery
load_sidebar = ->
$('#sidebar').sidebar
toggle_link: '#toggle_sidebar'
main_content: '#main',
wookmark: '#tiles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment