1/* 2 * Show More jQuery Plugin 3 * Author: Jason Alvis 4 * Author Site: http://www.jasonalvis.com 5 * License: Free General Public License (GPL) 6 * Version: 1.0.4 7 * Date: 21.05.2013 8 */ 9(function(jQuery) { 10 jQuery.fn.showMore = function (options) { 11 12 // Default showmore 13 var defaults = { 14 speedDown : 300, 15 speedUp : 300, 16 height : '265px', 17 showText : 'Show', 18 hideText : 'Hide' 19 }; 20 21 var options = jQuery.extend(defaults, options); 22 23 return this.each(function() { 24 var $this = jQuery(this), 25 $showMoreOrgHeight = $this.height(); 26 27 if( $showMoreOrgHeight > parseInt(options.height) ){ 28 // Insert showmore_content within the showmore div 29 $this.wrapInner('<div class="showmore_content" />'); 30 31 // Set the height of the showmore_content 32 $this.find('.showmore_content').css('height', options.height) 33 34 // Append the showmore trigger within the showmore div 35 $this.append('<div class="showmore_trigger"><span class="more">' + options.showText + '</span><span class="less" style="display:none;">' + options.hideText + '</span></div>') 36 37 // Showmore going down 38 $this.find('.showmore_trigger').on('click', '.more', function (){ 39 jQuery(this).hide(); 40 jQuery(this).next().show(); 41 $showMoreOrgHeight = $this.find('.showmore_content')[0].scrollHeight; // update in case of dynamic content 42 jQuery(this).parent().prev().animate({ height: $showMoreOrgHeight }, options.speedDown); 43 }); 44 45 // Showmore going up 46 $this.find('.showmore_trigger').on('click', '.less', function(){ 47 jQuery(this).hide(); 48 jQuery(this).prev().show(); 49 jQuery(this).parent().prev().animate({ height: options.height }, options.speedUp); 50 }); 51 } 52 53 }); 54 55 }; 56})(jQuery); 57 58/* 59 60BASIC USAGE 61$(document).ready(function() { 62 63 $('.showmore').showMore({ 64 speedDown: 300, 65 speedUp: 300, 66 height: '165px', 67 showText: 'Show more', 68 hideText: 'Show less' 69 }); 70 71}); 72 73DEFAULT STYLES, ADD TO YOUR CSS 74.showmore_content { position:relative; overflow:hidden; } 75.showmore_trigger { width:100%; height:45px; line-height:45px; cursor:pointer; } 76.showmore_trigger span { display:block; } 77 78*/
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.