Skip to content

Commit

Permalink
Fix conflict between animation of sub-menu icons and pjax (theme-next…
Browse files Browse the repository at this point in the history
  • Loading branch information
foxB612 authored and stevenjoezhang committed Jan 14, 2020
1 parent ec80c64 commit c4796bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions layout/_scripts/pjax.swig
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ window.addEventListener('pjax:success', () => {
if (CONFIG.motion.enable) {
NexT.motion.integrator
.init()
.add(NexT.motion.middleWares.subMenu)
.add(NexT.motion.middleWares.postList)
.bootstrap();
}
Expand Down
13 changes: 9 additions & 4 deletions source/js/motion.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ NexT.motion.middleWares = {
},

menu: function(integrator) {

Velocity(document.querySelectorAll('.menu-item'), 'transition.slideDownIn', {
display : null,
duration: 200,
Expand All @@ -112,8 +111,15 @@ NexT.motion.middleWares = {
}
},

postList: function(integrator) {
subMenu: function(integrator) {
var subMenuItem = document.querySelectorAll('.sub-menu .menu-item');
if (subMenuItem.length > 0) {
subMenuItem.forEach(element => element.style.opacity = 1);
}
integrator.next();
},

postList: function(integrator) {
var postBlock = document.querySelectorAll('.post-block, .pagination, .comments');
var postBlockTransition = CONFIG.motion.transition.post_block;
var postHeader = document.querySelectorAll('.post-header');
Expand All @@ -122,9 +128,8 @@ NexT.motion.middleWares = {
var postBodyTransition = CONFIG.motion.transition.post_body;
var collHeader = document.querySelectorAll('.collection-header');
var collHeaderTransition = CONFIG.motion.transition.coll_header;
var hasPost = postBlock.length > 0;

if (hasPost) {
if (postBlock.length > 0) {
var postMotionOptions = window.postMotionOptions || {
stagger : 100,
drag : true,
Expand Down

0 comments on commit c4796bd

Please sign in to comment.