1/*! 2 * strength.js 3 * Original author: @aaronlumsden 4 * Further changes, comments: @aaronlumsden 5 * Licensed under the MIT license 6 */ 7;(function ( $, window, document, undefined ) { 8 9 var pluginName = "tabulous", 10 defaults = { 11 effect: 'scale' 12 }; 13 14 // $('<style>body { background-color: red; color: white; }</style>').appendTo('head'); 15 16 function Plugin( element, options ) { 17 this.element = element; 18 this.$elem = $(this.element); 19 this.options = $.extend( {}, defaults, options ); 20 this._defaults = defaults; 21 this._name = pluginName; 22 this.init(); 23 } 24 25 Plugin.prototype = { 26 27 init: function() { 28 29 var links = this.$elem.find('.tab_heading a'); 30 var firstchild = this.$elem.find('li:first-child').find('a'); 31 var lastchild = this.$elem.find('li:last-child').after('<span class="tabulousclear"></span>'); 32 33 if (this.options.effect == 'scale') { 34 tab_content = this.$elem.find('div').not(':first').not(':nth-child(1)').addClass('hidescale'); 35 } else if (this.options.effect == 'slideLeft') { 36 tab_content = this.$elem.find('div').not(':first').not(':nth-child(1)').addClass('hideleft'); 37 } else if (this.options.effect == 'scaleUp') { 38 tab_content = this.$elem.find('div').not(':first').not(':nth-child(1)').addClass('hidescaleup'); 39 } else if (this.options.effect == 'flip') { 40 tab_content = this.$elem.find('div').not(':first').not(':nth-child(1)').addClass('hideflip'); 41 } 42 43 var firstdiv = this.$elem.find('.tabs_container'); 44 var firstdivheight = firstdiv.find('div:first').css('height'); 45 46 var alldivs = this.$elem.find('div:first').find('div'); 47 48 alldivs.css({'position': 'absolute','top':'40px'}); 49 50 firstdiv.css('height',firstdivheight); 51 52 firstchild.addClass('tabulous_active'); 53 54 links.bind('click', {myOptions: this.options}, function(e) { 55 e.preventDefault(); 56 57 var $options = e.data.myOptions; 58 var effect = $options.effect; 59 60 var mythis = $(this); 61 var thisform = mythis.parent().parent().parent(); 62 var thislink = mythis.attr('href'); 63 64 65 firstdiv.addClass('transition'); 66 67 links.removeClass('tabulous_active'); 68 mythis.addClass('tabulous_active'); 69 thisdivwidth = thisform.find('div'+thislink).css('height'); 70 71 if (effect == 'scale') { 72 alldivs.removeClass('showscale').addClass('make_transist').addClass('hidescale'); 73 thisform.find('div'+thislink).addClass('make_transist').addClass('showscale'); 74 } else if (effect == 'slideLeft') { 75 alldivs.removeClass('showleft').addClass('make_transist').addClass('hideleft'); 76 thisform.find('div'+thislink).addClass('make_transist').addClass('showleft'); 77 } else if (effect == 'scaleUp') { 78 alldivs.removeClass('showscaleup').addClass('make_transist').addClass('hidescaleup'); 79 thisform.find('div'+thislink).addClass('make_transist').addClass('showscaleup'); 80 } else if (effect == 'flip') { 81 alldivs.removeClass('showflip').addClass('make_transist').addClass('hideflip'); 82 thisform.find('div'+thislink).addClass('make_transist').addClass('showflip'); 83 } 84 85 firstdiv.css('height',thisdivwidth); 86 87 }); 88 89 90 91 92 93 94 }, 95 96 yourOtherFunction: function(el, options) { 97 // some logic 98 } 99 }; 100 101 // A really lightweight plugin wrapper around the constructor, 102 // preventing against multiple instantiations 103 $.fn[pluginName] = function ( options ) { 104 return this.each(function () { 105 new Plugin( this, options ); 106 }); 107 }; 108 109})( jQuery, window, document ); 110 111
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.