Jack Lukic
11 years ago
6 changed files with 116 additions and 73 deletions
Split View
Diff Options
-
13docs/button.html
-
82docs/javascript/example.js
-
82docs/javascript/shape.js
-
1docs/shape.html
-
11src/ui/flat/button.css
-
0src/ui/flat/menu.css
@ -0,0 +1,82 @@ |
|||
// namespace
|
|||
var shape = { |
|||
handler: {} |
|||
}; |
|||
|
|||
// ready event
|
|||
shape.ready = function() { |
|||
|
|||
// selector cache
|
|||
var |
|||
$demo = $('.demo'), |
|||
$directionButton = $('.direction .button'), |
|||
$shapeButton = $('.shape .button'), |
|||
// alias
|
|||
handler |
|||
; |
|||
|
|||
// event handlers
|
|||
handler = { |
|||
rotate: function() { |
|||
var |
|||
direction = $(this).data('direction') || false, |
|||
animation = $(this).data('animation') || false |
|||
; |
|||
if(direction && animation) { |
|||
$('.active.side') |
|||
.next() |
|||
; |
|||
$demo |
|||
.shape(animation + '.' + direction) |
|||
; |
|||
} |
|||
}, |
|||
|
|||
removeShape: function(){ |
|||
var |
|||
shape = $(this).data('shape') || false |
|||
; |
|||
if(shape) { |
|||
$demo |
|||
.removeClass(shape) |
|||
; |
|||
} |
|||
}, |
|||
|
|||
changeShape: function() { |
|||
var |
|||
$shape = $(this), |
|||
$otherShapes = $shape.siblings(), |
|||
shape = $shape.data('shape') |
|||
; |
|||
$shape |
|||
.addClass('active') |
|||
; |
|||
$otherShapes |
|||
.removeClass('active') |
|||
.each(handler.removeShape) |
|||
; |
|||
$demo |
|||
.addClass(shape) |
|||
; |
|||
} |
|||
}; |
|||
|
|||
// attach events
|
|||
$demo |
|||
.shape() |
|||
; |
|||
$directionButton |
|||
.on('click', handler.rotate) |
|||
; |
|||
$shapeButton |
|||
.on('click', handler.changeShape) |
|||
; |
|||
|
|||
}; |
|||
|
|||
|
|||
// attach ready event
|
|||
$(document) |
|||
.ready(shape.ready) |
|||
; |
Write
Preview
Loading…
Cancel
Save