Skip to content

Instantly share code, notes, and snippets.

@antonkulaga
Created May 14, 2013 13:04
Show Gist options
  • Save antonkulaga/5575690 to your computer and use it in GitHub Desktop.
Save antonkulaga/5575690 to your computer and use it in GitHub Desktop.
Several widgets on one page
jQuery ->
params =
widget_margins: [10, 10]
widget_base_dimensions: [250, 250]
shift_larger_widgets_down: false
draggable:
items: ".gs_w:not(.dashboard_static)"
gridster = $(".gridster ul").gridster(params).data('gridster');
users = $ "#userboard"
messages = $ "#messageboard"
tasks = $ "#taskboard"
frame = $ "#frameboard"
graph = $ "#graphboard"
search = $ "#searchboard"
proteins = $ "#proteinboard"
myvid = $ "#myvideo"
othervid1 = $ "#othervideo1"
othervid2 = $ "#othervideo2"
#gridster.add_widget(othervid1, 1, 1, 1, 1)
#gridster.add_widget(othervid2, 1, 1, 2, 1)
#gridster.add_widget(myvid, 1, 1, 3, 1)
gridster.add_widget(users, 1, 1, 4, 1)
gridster.add_widget(tasks, 1, 2, 1, 2)
gridster.add_widget(graph, 2, 2, 2, 2)
gridster.add_widget(messages, 1, 2, 4, 2)
gridster.add_widget(proteins, 2, 2, 2, 4)
gridster.add_widget(search, 1, 1, 1, 4)
slotParams = #this params override params variable
widget_margins: [10, 10]
widget_base_dimensions: [100, 100]
shift_larger_widgets_down: false
sidebar = $(".sidebar ul").gridster(slotParams).data('sidebar') #does not work
slots = $(".slots ul").gridster(slotParams).data('slots') #does not work
slots.add_widget(myvid, 1, 1, 1, 1)
slots.add_widget(othervid1, 1, 1, 2, 1)
slots.add_widget(othervid2, 1, 1, 3, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment