1 $(document).ready(function() {
\r
2 var hash = window.location.hash.replace('#', '');
\r
4 if (hash && $('.' + hash).length) {
\r
5 var point = $('.' + hash).offset().top - 40;
\r
8 window.scrollTo(0, point);
\r
10 $(window).scrollTop($('.' + hash).offset().top - 40);
\r
14 $('.skin dt').click(function() {
\r
15 $(this).siblings().removeClass('selected').end().prev('dd').andSelf().addClass('selected');
\r
18 $('.arrows .top, .arrows .bottom, .features .self, .skins-info .self, .usage .self').click(function(event) {
\r
19 var target = $(this).data('to'),
\r
20 target_offset = $('.' + target).offset().top;
\r
22 event.preventDefault();
\r
23 window.location.hash = target;
\r
26 window.scrollTo(0, target_offset - 40);
\r
28 $('html, body').stop().animate({scrollTop: target_offset - 40}, 600);
\r
32 $('.colors li').click(function() {
\r
35 if (!self.hasClass('active')) {
\r
36 self.siblings().removeClass('active');
\r
38 var skin = self.closest('.skin'),
\r
39 color = self.attr('class') ? '-' + self.attr('class') : '',
\r
40 checkbox = skin.data('icheckbox'),
\r
41 radio = skin.data('iradio'),
\r
42 checkbox_default = 'icheckbox_minimal',
\r
43 radio_default = 'iradio_minimal';
\r
45 if (skin.hasClass('skin-square')) {
\r
46 checkbox_default = 'icheckbox_square', radio_default = 'iradio_square';
\r
47 checkbox == undefined && (checkbox = 'icheckbox_square-green', radio = 'iradio_square-green');
\r
50 if (skin.hasClass('skin-flat')) {
\r
51 checkbox_default = 'icheckbox_flat', radio_default = 'iradio_flat';
\r
52 checkbox == undefined && (checkbox = 'icheckbox_flat-red', radio = 'iradio_flat-red');
\r
55 if (skin.hasClass('skin-line')) {
\r
56 checkbox_default = 'icheckbox_line', radio_default = 'iradio_line';
\r
57 checkbox == undefined && (checkbox = 'icheckbox_line-blue', radio = 'iradio_line-blue');
\r
60 checkbox == undefined && (checkbox = checkbox_default, radio = radio_default);
\r
62 skin.find('input, .skin-states .state').each(function() {
\r
63 var element = $(this).hasClass('state') ? $(this) : $(this).parent(),
\r
64 element_class = element.attr('class').replace(checkbox, checkbox_default + color).replace(radio, radio_default + color);
\r
66 element.attr('class', element_class);
\r
69 skin.data('icheckbox', checkbox_default + color);
\r
70 skin.data('iradio', radio_default + color);
\r
71 self.addClass('active');
\r
75 $('.demo-methods dt .self').click(function() {
\r
77 self_class = self.attr('class').replace('self ', '');
\r
79 switch (self_class) {
\r
81 $('#input-1, #input-3').iCheck('check');
\r
84 $('#input-1, #input-3').iCheck('uncheck');
\r
87 $('#input-2, #input-4').iCheck('disable');
\r
90 $('#input-2, #input-4').iCheck('enable');
\r
93 $('.demo-list input').iCheck('destroy');
\r
96 var text = self.hasClass('active') ? 'show code' : 'hide code';
\r
98 self.toggleClass('active').text(text);
\r
100 if (window.Zepto) {
\r
101 $(this).closest('dt').next().toggle();
\r
103 $(this).closest('dt').next().slideToggle(200);
\r