Created
December 12, 2015 13:02
Office UI Fabric Advent Calendar 2015用のパネルのサンプルプログラムで使用しているヘルパスクリプトです。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Office UI Fabric Advent Calendar 2015用のパネルの | |
* サンプルプログラムで使用しているヘルパスクリプト | |
* | |
* 以下のサンプルプログラム(MIT License)のJSコードをサンプル用に一部 | |
* 修正しています。 | |
* Panel | |
* http://dev.office.com/fabric/components/panel | |
*/ | |
// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE in the project ro ot for license information. | |
/** | |
* Panel Plugin | |
* | |
* Adds basic demonstration functionality to .ms-Panel components. | |
* | |
* @param {jQuery Object} One or more .ms-Panel components | |
* @return {jQuery Object} The same components (allows for chaining) | |
*/ | |
(function ($) { | |
$.fn.Panel = function () { | |
/** Go through each panel we've been given. */ | |
return this.each(function () { | |
var $panel = $(this); | |
var $panelMain = $panel.find(".ms-Panel-main"); | |
/** Hook to open the panel. */ | |
$(".js-togglePanel").on("click", function() { | |
// Panel must be set to display "block" in order for animations to render | |
$panelMain.css({display: "block"}); | |
$panel.toggleClass("is-open"); | |
}); | |
$panelMain.on("animationend webkitAnimationEnd MSAnimationEnd", function(event) { | |
if (event.originalEvent.animationName === "fadeOut") { | |
// Hide and Prevent ms-Panel-main from being interactive | |
$(this).css({display: "none"}); | |
} | |
}); | |
}); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment