Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run animation after card is open #493

Merged
merged 1 commit into from Mar 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -35,10 +35,14 @@ this.GobiertoBudgetConsultations.ConsultationResponsesController = (function() {
el.style.opacity = 0
},
enter: function (el, done) {
$(el).velocity("transition.slideDownIn", {duration: 200, delay: 100, complete: done});
$(el).velocity("transition.slideDownIn", {duration: 200, delay: 250, complete: function(){
$('body').animate({
scrollTop: $(el).offset().top - 85
}, 400);
}});
},
leave: function (el, done) {
$(el).velocity("transition.slideUpOut", {duration: 200, complete: done});
$(el).velocity("transition.slideUpOut", {duration: 200, complete: function(){}});
}
}
});
Expand Down Expand Up @@ -270,25 +274,6 @@ this.GobiertoBudgetConsultations.ConsultationResponsesController = (function() {
}
$targetDescription.css({ top: offset + 'px' });
}

window.setTimeout(function(){
// Scroll to selected card
// Set the description status
$('body').animate({
scrollTop: $target.offset().top - (isMobile() ? 25 : 85)
}, 300, function() {
// Set individual card state
if(isMobile()){
// Once animation ends, check if the span is visible
var isVisible = $target.find('.visibilityCheck').visible();

if (isVisible !== 'undefined') {
// If is not visible, set hidden to true
currentCard.hidden = isVisible ? false : true;
}
}
});
}, (isMobile() ? 250 : 0));
});

bus.$on('open', function(d) {
Expand Down