You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
833 B
54 lines
833 B
semantic.button = {};
|
|
|
|
// ready event
|
|
semantic.button.ready = function() {
|
|
|
|
// selector cache
|
|
var
|
|
$buttons = $('.ui.buttons .button'),
|
|
$toggle = $('.main .ui.toggle.button'),
|
|
$follow = $('.follow.example .button'),
|
|
$button = $('.ui.button').not($buttons).not($toggle),
|
|
// alias
|
|
handler = {
|
|
|
|
activate: function() {
|
|
$(this)
|
|
.addClass('active')
|
|
.siblings()
|
|
.removeClass('active')
|
|
;
|
|
}
|
|
|
|
}
|
|
;
|
|
|
|
$buttons
|
|
.on('click', handler.activate)
|
|
;
|
|
|
|
$follow
|
|
.state({
|
|
text: {
|
|
inactive : 'Follow',
|
|
active : 'Following'
|
|
}
|
|
})
|
|
;
|
|
|
|
$toggle
|
|
.state({
|
|
text: {
|
|
inactive : 'Vote',
|
|
active : 'Voted'
|
|
}
|
|
})
|
|
;
|
|
|
|
};
|
|
|
|
|
|
// attach ready event
|
|
$(document)
|
|
.ready(semantic.button.ready)
|
|
;
|