1(function ( $ ) { 2 3 /* 4 Plugin: ShowMore 5 author: [email protected] 6 */ 7 8 $.fn.showMore = function (options) { 9 10 "use strict"; 11 12 var currentelem = 1; 13 14 this.each(function(){ 15 16 var currentid = ''; 17 var element = $(this); 18 var auto = parseInt(element.innerHeight())/2; 19 var fullheight = element.innerHeight(); 20 var maxWidth = element.css('width'); 21 var settings = $.extend({ 22 minheight: auto, 23 buttontxtmore: "show more", 24 buttontxtless: "show less", 25 buttoncss: "showmore-button", 26 animationspeed: auto 27 }, options ); 28 29 element.attr('id') != undefined ? currentid = element.attr('id') : currentid = currentelem; 30 element.wrap( "<div id='showmore-"+currentid+"' data-showmore"+(maxWidth == '0px' ? "" : " style='max-width:"+maxWidth+";'")+"></div>" ); 31 32 if (element.parent().not('[data-showmore]')) { 33 34 if (fullheight > settings.minheight) { 35 36 element.css('min-height', settings.minheight).css('max-height', settings.minheight).css('overflow', 'hidden'); 37 var showMoreButton = $("<div />", { 38 id: "showmore-button-"+currentid, 39 "class": settings.buttoncss, 40 click: function() { 41 42 if (element.css('max-height') != 'none') { 43 element.css('height', settings.minheight).css('max-height', '').animate({height:fullheight}, settings.animationspeed, function () { showMoreButton.html(settings.buttontxtless); }); 44 } else { 45 element.animate({height:settings.minheight}, settings.animationspeed, function () { showMoreButton.html(settings.buttontxtmore); element.css('max-height', settings.minheight); }); 46 } 47 }, 48 html: settings.buttontxtmore 49 }); 50 51 element.after(showMoreButton); 52 53 } 54 55 currentelem++; 56 57 } 58 59 }); 60 61 return this; 62 63 }; 64 65}(jQuery)); 66 67$(function(){ 68 var open_flg = 0; 69 $('.showmore-button').on('click',function () { 70 var showmoreList = $(this).prev().attr('id'); 71 console.log(showmoreList); 72 var showmoreTop = $('#' + showmoreList).offset().top - 120; 73 var target = $('#' + showmoreList); 74 if(!target.hasClass('on')) { 75 target.addClass('on'); 76 $(this).addClass('open'); 77 } else { 78 target.removeClass('on'); 79 $(this).removeClass('open'); 80 $('body,html').animate({ 81 scrollTop: showmoreTop 82 }, 300); 83 } 84 }); 85});
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.