Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix key typo

  • Loading branch information...
commit 350ae52ae1f0182a3abc850774ffce23552c8c43 1 parent ef35170
@SlexAxton SlexAxton authored
Showing with 17 additions and 17 deletions.
  1. +17 −17 src/gfx.cube.coffee
View
34 src/gfx.cube.coffee
@@ -2,24 +2,24 @@ $ = jQuery
sides =
front: {rotateY: '0deg', rotateX: '0deg'}
- back: {rotateX: '-180deg', rotateX: '0deg'}
+ back: {rotateY: '-180deg', rotateX: '0deg'}
right: {rotateY: '-90deg', rotateX: '0deg'}
left: {rotateY: '90deg', rotateX: '0deg'}
top: {rotateY: '0deg', rotateX: '-90deg'}
bottom: {rotateY: '0deg', rotateX: '90deg'}
-defaults =
+defaults =
width: 300
height: 300
$.fn.gfxCube = (options) ->
opts = $.extend({}, defaults, options)
-
+
element = $(@)
-
+
tZ = opts.translateZ or opts.width / 2
tZ += 'px' if typeof tZ is 'number'
-
+
element.transform
position: 'relative'
width: opts.width
@@ -28,7 +28,7 @@ $.fn.gfxCube = (options) ->
'-moz-perspective': '3000'
'-webkit-perspective-origin': '50% 50%'
'-moz-perspective-origin': '50% 50%'
-
+
wrapper = $('<div />')
wrapper.addClass('gfxCubeWrapper')
wrapper.transform
@@ -43,9 +43,9 @@ $.fn.gfxCube = (options) ->
translateZ: "-#{tZ}"
'-webkit-transform-style': 'preserve-3d'
'-moz-transform-style': 'preserve-3d'
- '-webkit-transform-origin': '50% 50%'
- '-moz-transform-origin': '50% 50%'
-
+ '-webkit-transform-origin': '50% 50%'
+ '-moz-transform-origin': '50% 50%'
+
element.children().wrapAll(wrapper).css
display: 'block'
position: 'absolute'
@@ -54,25 +54,25 @@ $.fn.gfxCube = (options) ->
left: 0
top: 0
overflow: 'hidden'
-
+
front = element.find('.front')
back = element.find('.back')
right = element.find('.right')
left = element.find('.left')
top = element.find('.top')
bottom = element.find('.bottom')
-
+
front.transform rotateY: '0deg', translateZ: tZ
back.transform rotateY: '180deg', translateZ: tZ
right.transform rotateY: '90deg', translateZ: tZ
left.transform rotateY: '-90deg', translateZ: tZ
top.transform rotateX: '90deg', translateZ: tZ
bottom.transform rotateX: '-90deg', translateZ: tZ
-
+
$(@).bind 'cube', (e, type) ->
wrapper = element.find('.gfxCubeWrapper')
wrapper.gfx($.extend({}, {translateZ: "-#{tZ}"}, sides[type]))
-
+
# Disable cubes in Firefox / Chrome < 12
chromeRegex = /(Chrome)[\/]([\w.]+)/
chromeMatch = chromeRegex.exec( navigator.userAgent ) or []
@@ -81,14 +81,14 @@ chrome11 = chromeRegex[1] and chromeRegex[2].test(/^12\./)
if not $.browser.webkit or chrome11
$.fn.gfxCube = (options) ->
opts = $.extend({}, defaults, options)
-
+
element = $(@)
-
+
element.css
position: 'relative'
width: opts.width
height: opts.height
-
+
wrapper = $('<div />')
wrapper.addClass('gfxCubeWrapper')
wrapper.transform
@@ -109,7 +109,7 @@ if not $.browser.webkit or chrome11
overflow: 'hidden'
wrapper = element.find('.gfxCubeWrapper')
-
+
wrapper.children('*:not(.front)').hide()
element.bind 'cube', (e, type) ->
wrapper.children().hide()
Please sign in to comment.
Something went wrong with that request. Please try again.