Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function toggleTabWithSwitch() {
- var toggleSwitch = $('#switch-toggle-tab label.switch');
- var TabTitle = $('#switch-toggle-tab li');
- var monthTabTitle = $('#switch-toggle-tab li.month');
- var yearTabTitle = $('#switch-toggle-tab li.year');
- var monthTabContent = $('#month');
- var yearTabContent = $('#year');
- // hidden show deafult;
- monthTabContent.fadeIn();
- yearTabContent.fadeOut();
- function toggleHandle() {
- if (toggleSwitch.hasClass('on')) {
- yearTabContent.fadeOut();
- monthTabContent.fadeIn();
- monthTabTitle.addClass('active');
- yearTabTitle.removeClass('active');
- } else {
- monthTabContent.fadeOut();
- yearTabContent.fadeIn();
- yearTabTitle.addClass('active');
- monthTabTitle.removeClass('active');
- }
- };
- monthTabTitle.on('click', function() {
- toggleSwitch.addClass('on').removeClass('off');
- toggleHandle();
- return false;
- });
- yearTabTitle.on('click', function() {
- toggleSwitch.addClass('off').removeClass('on');
- toggleHandle();
- return false;
- });
- toggleSwitch.on('click', function() {
- toggleSwitch.toggleClass('on off');
- toggleHandle();
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement