-
Notifications
You must be signed in to change notification settings - Fork 260
/
Copy pathsample.coffee
32 lines (25 loc) · 864 Bytes
/
sample.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$ ->
brick = "<div class='brick small'><div class='delete'>×</div></div>"
$(document).on "click touchend", ".gridly .brick", (event) ->
event.preventDefault()
event.stopPropagation()
$this = $(this)
$this.toggleClass('small')
$this.toggleClass('large')
size = 140 if $this.hasClass('small') # HACK
size = 300 if $this.hasClass('large') # HACK
$this.data('width', size)
$this.data('height', size)
$('.gridly').gridly 'layout'
$(document).on "click", ".gridly .delete", (event) ->
event.preventDefault()
event.stopPropagation()
$this = $(this)
$this.closest('.brick').remove()
$('.gridly').gridly 'layout'
$(document).on "click", ".add", (event) ->
event.preventDefault()
event.stopPropagation()
$('.gridly').append(brick)
$('.gridly').gridly()
$('.gridly').gridly()