Skip to content

Instantly share code, notes, and snippets.

@furandon-pig
Created December 12, 2015 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save furandon-pig/701ec8a958b4d80c34fb to your computer and use it in GitHub Desktop.
Save furandon-pig/701ec8a958b4d80c34fb to your computer and use it in GitHub Desktop.
Office UI Fabric Advent Calendar 2015用のパネルのサンプルプログラムで使用しているヘルパスクリプトです。
/*
* 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