Skip to content

Instantly share code, notes, and snippets.

View mainyaa's full-sized avatar

Kazuyuki Mori mainyaa

  • Topgate, Inc.
  • Tokyo, JP
View GitHub Profile
@mainyaa
mainyaa / jquery-animation-optimize.js
Created July 8, 2012 16:22
Monkey patch for jQuery 1.7 to optimize animation
(function ($) {
// Monkey patch for jQuery 1.7 to optimize animation
// Details:
// jQuery(this).is(":hidden")) access elem.offsetHeight property in each animation step.
// This patch enables lazy access to elem.offsetHeight property only when it is necessary.
// 2012/07/26: this patch is unnecessary on jQuery 1.8. fixed by https://github.com/jquery/jquery/pull/869
var elemdisplay = {},
iframe, iframeDoc,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,