From 3e8b34be2fdeccf16c8b46f1ee518f970853768d Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Tue, 24 Oct 2017 16:59:48 -0400 Subject: Adding in materialize source and templates --- app/dispatch/static/materialize/js/cards.js | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 app/dispatch/static/materialize/js/cards.js (limited to 'app/dispatch/static/materialize/js/cards.js') diff --git a/app/dispatch/static/materialize/js/cards.js b/app/dispatch/static/materialize/js/cards.js new file mode 100644 index 0000000..7e06f94 --- /dev/null +++ b/app/dispatch/static/materialize/js/cards.js @@ -0,0 +1,36 @@ +(function ($) { + $(document).ready(function() { + + $(document).on('click.card', '.card', function (e) { + if ($(this).find('> .card-reveal').length) { + var $card = $(e.target).closest('.card'); + if ($card.data('initialOverflow') === undefined) { + $card.data( + 'initialOverflow', + $card.css('overflow') === undefined ? '' : $card.css('overflow') + ); + } + if ($(e.target).is($('.card-reveal .card-title')) || $(e.target).is($('.card-reveal .card-title i'))) { + // Make Reveal animate down and display none + $(this).find('.card-reveal').velocity( + {translateY: 0}, { + duration: 225, + queue: false, + easing: 'easeInOutQuad', + complete: function() { + $(this).css({ display: 'none'}); + $card.css('overflow', $card.data('initialOverflow')); + } + } + ); + } + else if ($(e.target).is($('.card .activator')) || + $(e.target).is($('.card .activator i')) ) { + $card.css('overflow', 'hidden'); + $(this).find('.card-reveal').css({ display: 'block'}).velocity("stop", false).velocity({translateY: '-100%'}, {duration: 300, queue: false, easing: 'easeInOutQuad'}); + } + } + }); + + }); +}( jQuery )); -- cgit v1.2.3