Jump to content
Search Community

Nada

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Nada

  1. Hey guys!
    I have a problem with reverse function, It reverse all play animation which happened after click.
     

    document.addEventListener('DOMContentLoaded', function () {
    	var menuitem__click = $('.submenu__item'),
    	$document = $(document),
    	action__zone = $('.action__zone'),
    	counter = false,
    	counter_uniqe = false,
    	$click = $('.click'),
    	menu_tween_1= new TimelineMax({
    					paused: true,
    					reversed: true,
    					align: 'sequence',
    				});
    	//TweenMax.set ( $('.action__item'), { visibility: 'hidden' } );
    	menuitem__click.on('click', function() {
    		var $this = $(this),
    			id = $(this).attr('data-id'),
    			$cont = $('.action__item[data-id="'+id+'"]'),
    			$cont_item = $('.action__item[data-id="'+id+'"] .menu-holder__list .menu-holder__item'),
    			$thisClick = ($cont + "Click");
    			
    		menu_tween_1
    			.to('.action__zone', 0,{className:"+=active"})
    			.to('.action__zone', .01,{autoAlpha:"1",ease:Power1.easeOut})
    			//.to('.action__item', 0,{className:"-=active"})
    			//.to($cont, 0,{className:"+=active"})
    			.to('.menu-holder__bg', 0.8,{scaleX:1,ease:Power2.easeInOut})
    			.staggerFromTo($cont_item, 1.3,{autoAlpha:0,x:80},{autoAlpha:1,x:0 ,ease:Power2.easeInOut},.06);	
    			
    		if($cont.length) {
    			$('.action__item').removeClass('active');
    			$cont.addClass('active');
    			menu_tween_1.play();
    		}
    		else {
    			menu_tween_1.reverse();
    		}	
    	});
    });

     

×
×
  • Create New...