/
pins.js.coffee
43 lines (36 loc) · 1.18 KB
/
pins.js.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
33
34
35
36
37
38
39
40
41
42
43
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# pins on index page
$ ->
$pins = $("#pins")
$pins.imagesLoaded ->
$pins.masonry
itemSelector: "#boxIndexPin"
# Pin Show page
$(window).load ->
# set jQuery object variables
$windowObj = $(window)
$showPinContainer = $("#showPinContainer")
$showPin = $("#showPin")
$showPinRow = $("#showPinRow")
$showPinImg = $("#showPin img")
$showPinHeight = $("#showPin").outerHeight()
$showPinImgWidth = $showPinImg.outerWidth()
setShowPinContainerHeight = ->
if $showPinHeight < 450
$showPinContainer.outerHeight( 450 )
setShowPinContainerWidth = ->
if $showPinImgWidth < 200
$showPin.outerWidth( 200 )
else if $showPinImgWidth > 700
$showPinImg.outerWidth( 700 )
else
$showPinContainer.outerWidth( $showPinImgWidth )
setShowPinContainerSize = ->
setShowPinContainerWidth()
setShowPinContainerHeight()
adjustLayout = ->
setShowPinContainerSize()
$showPinContainer.offset
left: ($showPinRow.width() - $showPin.outerWidth()) / 2
$windowObj.resize(adjustLayout).resize()