Jump to content
Search Community

DD77

Members
  • Posts

    171
  • Joined

  • Last visited

Posts posted by DD77

  1. I'm quite stuck here, as I need a class active on the navigation Menu
    - the current section should have the relative menu active. 
    is it possible to achieve this?  I used to use className - and + but I know is not longer supported. 

    I'm also terrible confused with how the toggleClass/toggleAction works.

     
    Please come to the rescue . . . 

    See the Pen vYxZMxB by davide77 (@davide77) on CodePen

  2. On 10/19/2020 at 8:43 AM, mikel said:

    Hi @mikel

    I have a quick question for you. I have the functionality that woks exactly like your demo below.

    I need to add a class Active to each button instead of the background color. 
    Whats the best approach? I know className: '-=' className: '+=' are not longer supported? 

     

     

     

    Happy tweening ...

    Mikel

     

  3. Thank you Mikel, as usual you turned a some code into a piss of cake...
    On my demo, I have multiple buttons, where I can open the modal. Then once opened a simple closing button, with a click outside the modal that could close it too.
    On your demo I think you misinterpreted my initial question. 

  4. HI All,

    I was hopping to grab some of your amazing brain as I need to make this animation work like a charm :-) 

    I have a line that should animate while scrolling down. I'm kind of there pretty much, but I have the line that animates in the opposite way!!!

     

    So, line animates balls(icons)  animates with it. Anyone able to explain what I'm missing? 

    Thank you for any help you can offer!!!

     

    See the Pen ExxMdyp?editors=1010 by davide77 (@davide77) on CodePen

  5. 48 minutes ago, ZachSaucier said:

    Hey DD77. 

     

    Currently you can't tween to a value of "auto". Instead, you should use a .set() to the "auto" value then immediately use a .from() a value of 0.

     

    However, you currently have some conflicting tweens. You're trying to close all of the options and then open the clicked one at the same time. You need to change your logic so that the tweens don't conflict.

     

    Other notes:

    • You don't need to use a jQuery selector in your tweens. By default selector strings are parsed using JavaScript's .querySelectorAll() method.
    • You should avoid using jQuery's animate. Plus it doesn't work with GSAP's scrollTo plugin.

     

     

     

    P.S. The next version of GSAP currently has a way to tween to a value of "auto" built in :) 

    any reaso why the TweenMax.to(window, 1, { scrollTop: theOffset.top - 56 }); isn't working now? 

  6. Hi YA,
    I'm having so difficulties to make this functionality to work smoother and better. I need auto hight as my content is quite dynamic. 
    When I click the height of the accordion fires but doesn't have and smoothens on the animation. What am I missing? 
    Also is it done all ok overall? Would you change anything in there? 

    Thanks,

    D

     

    $(".accordion-item .button").click(playAnimation);
    
      function playAnimation(event) {
        event.preventDefault(); 
         
        
        var $this = $(this).parent();
        var $thisContent = $this.find('.accordion-content .article');
        
        
        TweenLite.to($this,.3, {className: '-=expanded'});
        TweenMax.to($thisContent, .3,  {autoAlpha:0,ease: Sine.easeInOut,
            onComplete:function() {
                TweenMax.to($('.accordion-content .article'), .3, {height: "0",ease: Sine.easeInOut})
            }
        })
        
           if (!$this.hasClass('expanded')){
                var self = this;
                setTimeout(function() {
                    theOffset = $(self).offset();
                    $('body,html').animate({ scrollTop: theOffset.top - 56 });
                }, 310);
    
                TweenMax.to($(".accordion-item"), .3,  {className: '-=expanded', ease: Sine.easeInOut})
                TweenMax.to($this, .3,  {className: '+=expanded', ease: Sine.easeInOut})
    
                TweenMax.to($('.accordion-content .article'), .3,  {height: "0",autoAlpha:0, ease: Sine.easeInOut})
                TweenMax.to($thisContent, .3,  {height: "auto", ease: Sine.easeInOut,
                onComplete:function() {  
                    TweenMax.to($('.accordion-content .article'), .3, {autoAlpha:1,ease: Sine.easeInOut})
                }
            })
           } 
         
      } 

     

    See the Pen oNNzzNP?editors=1010 by davide77 (@davide77) on CodePen

  7. @Mikel thanks, really helpful, this helped me a lot.
    I'm not manages to:
    - add class to parent "expanded"

    -add function that move to top of the list the clicked element.

    todo: make it better, smother and perhaps without a feeling that the clicked one jumps to the top.
    @mikel what do you think? 

    See the Pen oKxpJw by davide77 (@davide77) on CodePen

×
×
  • Create New...