app/assets/javascripts/materialize/cards.js in materialize-sass-0.98.2 vs app/assets/javascripts/materialize/cards.js in materialize-sass-0.99.0
- old
+ new
@@ -1,23 +1,33 @@
(function ($) {
- $(document).on('turbolinks:load', function() {
+ $(document).on('ready turbolinks:load', 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'}); }
+ 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')) ) {
- $(e.target).closest('.card').css('overflow', 'hidden');
+ $card.css('overflow', 'hidden');
$(this).find('.card-reveal').css({ display: 'block'}).velocity("stop", false).velocity({translateY: '-100%'}, {duration: 300, queue: false, easing: 'easeInOutQuad'});
}
}
});