Difference between revisions of "MediaWiki:Common.js"

From Johnisdead Wiki
Jump to navigation Jump to search
(Blanked the page)
Tag: Blanking
Line 1: Line 1:
 +
var $el, $ps, $up, totalHeight;
  
 +
$(".sidebar-box .button").click(function() {
 +
     
 +
  totalHeight = 0
 +
 +
  $el = $(this);
 +
  $p  = $el.parent();
 +
  $up = $p.parent();
 +
  $ps = $up.find("p:not('.read-more')");
 +
 
 +
  // measure how tall inside should be by adding together heights of all inside paragraphs (except read-more paragraph)
 +
  $ps.each(function() {
 +
    totalHeight += $(this).outerHeight();
 +
  });
 +
       
 +
  $up
 +
    .css({
 +
      // Set height to prevent instant jumpdown when max height is removed
 +
      "height": $up.height(),
 +
      "max-height": 9999
 +
    })
 +
    .animate({
 +
      "height": totalHeight
 +
    });
 +
 
 +
  // fade out read-more
 +
  $p.fadeOut();
 +
 
 +
  // prevent jump-down
 +
  return false;
 +
   
 +
});

Revision as of 17:45, 28 December 2019

var $el, $ps, $up, totalHeight;

$(".sidebar-box .button").click(function() {
      
  totalHeight = 0

  $el = $(this);
  $p  = $el.parent();
  $up = $p.parent();
  $ps = $up.find("p:not('.read-more')");
  
  // measure how tall inside should be by adding together heights of all inside paragraphs (except read-more paragraph)
  $ps.each(function() {
    totalHeight += $(this).outerHeight();
  });
        
  $up
    .css({
      // Set height to prevent instant jumpdown when max height is removed
      "height": $up.height(),
      "max-height": 9999
    })
    .animate({
      "height": totalHeight
    });
  
  // fade out read-more
  $p.fadeOut();
  
  // prevent jump-down
  return false;
    
});