Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(window.$) {
- window.$.fn.tabbs = function(options) {
- var settings = {
- dir: 'top',
- trigger: 'a',
- target: '.tab-section',
- selected: 'selected'
- },
- html = $('html');
- window.alert('jquery object: ' + window.$);
- if (html.hasClass('no-js')) {
- html.removeClass('no-js').addClass('js');
- } else {
- html.addClass('js');
- }
- var classAction = function(obj, action, cls) {
- window.$(obj)[action](cls);
- };
- window.$.extend(settings, options);
- return this.each(function() {
- var tabs = window.$(this),
- tab = tabs.find(settings.trigger),
- tabSection = window.$(settings.target),
- tabsSystemContainer = tabs.closest('div');
- switch(settings.dir) {
- case 'left':
- tabsSystemContainer.removeClass(settings.dir || 'top').addClass('left' || settings.dir);
- break;
- default:
- tabsSystemContainer.removeClass('left' || settings.dir).addClass(settings.dir || 'top');
- }
- //this where I'm having problems
- tab.click(function(e) {
- var self = window.$(this);
- e.preventDefault();
- window.alert('Hello, inside tab click event...');
- });
- });
- };
- }(window.jQuery));
- window.$('.tabs').tabbs();
Add Comment
Please, Sign In to add comment