Greensock (gsap) Hamburger overlay










1















In my bootstarp website i added greensock (gsap) animation.
I have a one hamburger menu. So After click hamburger menu now the overlay opened left to right type, but i need right to left opening type.Itried as my best but i couldn't reach my expectations.so anyone help me to do this.I insert the url i referred in codepen.



https://codepen.io/larpo1/pen/VjzJQN



This is the gsap code i tried in my website



$(document).ready(function()
var menuIsOpen=false,
$menu=$(".menu"),
$menuItem=$(".menu-item"),
$menuBg=$(".menu-bg"),
$menuToggle=$(".menu-toggle"),

menuWidth=300,
menuItemOffset=150,
menuBgSkew=-10,
timeScale=v:1
;
TweenMax.globalTimeScale(timeScale.v);

TweenMax.set($menuItem,
x:-menuItemOffset
);
TweenMax.set($menuBg,
skewX:menuBgSkew
)
function setTimescale(v)
TweenMax.to(timeScale,0.5,
v:v,
ease:Quad.easeInOut,
onUpdate:updateTimescale,
onComplete:updateTimescale
);

function updateTimescale()
TweenMax.globalTimeScale(timeScale.v);


function openMenu()
menuIsOpen=true;
TweenMax.to($menu,0.55,
x:menuWidth,
force3D:false,
ease:Elastic.easeOut,
easeParams:[1.01,0.8]
);
TweenMax.to($menuBg,0.55,
skewX:0,
force3D:false,
ease:Elastic.easeOut,
easeParams:[1.01,0.8]
);
$menuItem.each(function(i)
TweenMax.to($(this),0.7+(i*0.05),
delay:0.02*i,
x:0,
force3D:false,
// ease:Quint.easeOut
ease:Elastic.easeOut,
easeParams:[1.1,0.6]
);
);


function closeMenu()
menuIsOpen=false;
TweenMax.to($menu,0.2,
x:-100,
ease:Quad.easeIn,
force3D:false
);
TweenMax.set($menuBg,
delay:0.2,
skewX:menuBgSkew,
force3D:false
);
$menuItem.each(function(i)
TweenMax.to($(this),0.3+(0.05*i),
x:-menuItemOffset,
ease:Quad.easeIn,
force3D:false
);
);



function toggleMenu()
if(menuIsOpen)
$menuToggle.removeClass('menu-open');
closeMenu();
else
$menuToggle.addClass('menu-open');
openMenu();


$menuToggle.click(function()
toggleMenu();
);
)









share|improve this question




























    1















    In my bootstarp website i added greensock (gsap) animation.
    I have a one hamburger menu. So After click hamburger menu now the overlay opened left to right type, but i need right to left opening type.Itried as my best but i couldn't reach my expectations.so anyone help me to do this.I insert the url i referred in codepen.



    https://codepen.io/larpo1/pen/VjzJQN



    This is the gsap code i tried in my website



    $(document).ready(function()
    var menuIsOpen=false,
    $menu=$(".menu"),
    $menuItem=$(".menu-item"),
    $menuBg=$(".menu-bg"),
    $menuToggle=$(".menu-toggle"),

    menuWidth=300,
    menuItemOffset=150,
    menuBgSkew=-10,
    timeScale=v:1
    ;
    TweenMax.globalTimeScale(timeScale.v);

    TweenMax.set($menuItem,
    x:-menuItemOffset
    );
    TweenMax.set($menuBg,
    skewX:menuBgSkew
    )
    function setTimescale(v)
    TweenMax.to(timeScale,0.5,
    v:v,
    ease:Quad.easeInOut,
    onUpdate:updateTimescale,
    onComplete:updateTimescale
    );

    function updateTimescale()
    TweenMax.globalTimeScale(timeScale.v);


    function openMenu()
    menuIsOpen=true;
    TweenMax.to($menu,0.55,
    x:menuWidth,
    force3D:false,
    ease:Elastic.easeOut,
    easeParams:[1.01,0.8]
    );
    TweenMax.to($menuBg,0.55,
    skewX:0,
    force3D:false,
    ease:Elastic.easeOut,
    easeParams:[1.01,0.8]
    );
    $menuItem.each(function(i)
    TweenMax.to($(this),0.7+(i*0.05),
    delay:0.02*i,
    x:0,
    force3D:false,
    // ease:Quint.easeOut
    ease:Elastic.easeOut,
    easeParams:[1.1,0.6]
    );
    );


    function closeMenu()
    menuIsOpen=false;
    TweenMax.to($menu,0.2,
    x:-100,
    ease:Quad.easeIn,
    force3D:false
    );
    TweenMax.set($menuBg,
    delay:0.2,
    skewX:menuBgSkew,
    force3D:false
    );
    $menuItem.each(function(i)
    TweenMax.to($(this),0.3+(0.05*i),
    x:-menuItemOffset,
    ease:Quad.easeIn,
    force3D:false
    );
    );



    function toggleMenu()
    if(menuIsOpen)
    $menuToggle.removeClass('menu-open');
    closeMenu();
    else
    $menuToggle.addClass('menu-open');
    openMenu();


    $menuToggle.click(function()
    toggleMenu();
    );
    )









    share|improve this question


























      1












      1








      1








      In my bootstarp website i added greensock (gsap) animation.
      I have a one hamburger menu. So After click hamburger menu now the overlay opened left to right type, but i need right to left opening type.Itried as my best but i couldn't reach my expectations.so anyone help me to do this.I insert the url i referred in codepen.



      https://codepen.io/larpo1/pen/VjzJQN



      This is the gsap code i tried in my website



      $(document).ready(function()
      var menuIsOpen=false,
      $menu=$(".menu"),
      $menuItem=$(".menu-item"),
      $menuBg=$(".menu-bg"),
      $menuToggle=$(".menu-toggle"),

      menuWidth=300,
      menuItemOffset=150,
      menuBgSkew=-10,
      timeScale=v:1
      ;
      TweenMax.globalTimeScale(timeScale.v);

      TweenMax.set($menuItem,
      x:-menuItemOffset
      );
      TweenMax.set($menuBg,
      skewX:menuBgSkew
      )
      function setTimescale(v)
      TweenMax.to(timeScale,0.5,
      v:v,
      ease:Quad.easeInOut,
      onUpdate:updateTimescale,
      onComplete:updateTimescale
      );

      function updateTimescale()
      TweenMax.globalTimeScale(timeScale.v);


      function openMenu()
      menuIsOpen=true;
      TweenMax.to($menu,0.55,
      x:menuWidth,
      force3D:false,
      ease:Elastic.easeOut,
      easeParams:[1.01,0.8]
      );
      TweenMax.to($menuBg,0.55,
      skewX:0,
      force3D:false,
      ease:Elastic.easeOut,
      easeParams:[1.01,0.8]
      );
      $menuItem.each(function(i)
      TweenMax.to($(this),0.7+(i*0.05),
      delay:0.02*i,
      x:0,
      force3D:false,
      // ease:Quint.easeOut
      ease:Elastic.easeOut,
      easeParams:[1.1,0.6]
      );
      );


      function closeMenu()
      menuIsOpen=false;
      TweenMax.to($menu,0.2,
      x:-100,
      ease:Quad.easeIn,
      force3D:false
      );
      TweenMax.set($menuBg,
      delay:0.2,
      skewX:menuBgSkew,
      force3D:false
      );
      $menuItem.each(function(i)
      TweenMax.to($(this),0.3+(0.05*i),
      x:-menuItemOffset,
      ease:Quad.easeIn,
      force3D:false
      );
      );



      function toggleMenu()
      if(menuIsOpen)
      $menuToggle.removeClass('menu-open');
      closeMenu();
      else
      $menuToggle.addClass('menu-open');
      openMenu();


      $menuToggle.click(function()
      toggleMenu();
      );
      )









      share|improve this question
















      In my bootstarp website i added greensock (gsap) animation.
      I have a one hamburger menu. So After click hamburger menu now the overlay opened left to right type, but i need right to left opening type.Itried as my best but i couldn't reach my expectations.so anyone help me to do this.I insert the url i referred in codepen.



      https://codepen.io/larpo1/pen/VjzJQN



      This is the gsap code i tried in my website



      $(document).ready(function()
      var menuIsOpen=false,
      $menu=$(".menu"),
      $menuItem=$(".menu-item"),
      $menuBg=$(".menu-bg"),
      $menuToggle=$(".menu-toggle"),

      menuWidth=300,
      menuItemOffset=150,
      menuBgSkew=-10,
      timeScale=v:1
      ;
      TweenMax.globalTimeScale(timeScale.v);

      TweenMax.set($menuItem,
      x:-menuItemOffset
      );
      TweenMax.set($menuBg,
      skewX:menuBgSkew
      )
      function setTimescale(v)
      TweenMax.to(timeScale,0.5,
      v:v,
      ease:Quad.easeInOut,
      onUpdate:updateTimescale,
      onComplete:updateTimescale
      );

      function updateTimescale()
      TweenMax.globalTimeScale(timeScale.v);


      function openMenu()
      menuIsOpen=true;
      TweenMax.to($menu,0.55,
      x:menuWidth,
      force3D:false,
      ease:Elastic.easeOut,
      easeParams:[1.01,0.8]
      );
      TweenMax.to($menuBg,0.55,
      skewX:0,
      force3D:false,
      ease:Elastic.easeOut,
      easeParams:[1.01,0.8]
      );
      $menuItem.each(function(i)
      TweenMax.to($(this),0.7+(i*0.05),
      delay:0.02*i,
      x:0,
      force3D:false,
      // ease:Quint.easeOut
      ease:Elastic.easeOut,
      easeParams:[1.1,0.6]
      );
      );


      function closeMenu()
      menuIsOpen=false;
      TweenMax.to($menu,0.2,
      x:-100,
      ease:Quad.easeIn,
      force3D:false
      );
      TweenMax.set($menuBg,
      delay:0.2,
      skewX:menuBgSkew,
      force3D:false
      );
      $menuItem.each(function(i)
      TweenMax.to($(this),0.3+(0.05*i),
      x:-menuItemOffset,
      ease:Quad.easeIn,
      force3D:false
      );
      );



      function toggleMenu()
      if(menuIsOpen)
      $menuToggle.removeClass('menu-open');
      closeMenu();
      else
      $menuToggle.addClass('menu-open');
      openMenu();


      $menuToggle.click(function()
      toggleMenu();
      );
      )






      javascript css gsap






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '18 at 14:09









      Justin T.

      612413




      612413










      asked Nov 13 '18 at 13:01









      Sankar SSankar S

      46




      46






















          1 Answer
          1






          active

          oldest

          votes


















          0














          To do this, you would need to go through the CSS and look for important position properties to modify. In this case, there were several left positions that I changed to right. Also, in the JS code, you would need to modify the parameters of the animation to ensure the menu "moves" in the correct direction. I have modified the code you posted and have a working example here:



          https://codepen.io/justinthielman/pen/rQydjY



          I did not need to modify the HTML, only the CSS and JS code.






          share|improve this answer























          • Thanks man...it worked...Awesome.

            – Sankar S
            Nov 14 '18 at 16:19











          • No problem, glad it worked for you!

            – Justin T.
            Nov 14 '18 at 16:30










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53281598%2fgreensock-gsap-hamburger-overlay%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          To do this, you would need to go through the CSS and look for important position properties to modify. In this case, there were several left positions that I changed to right. Also, in the JS code, you would need to modify the parameters of the animation to ensure the menu "moves" in the correct direction. I have modified the code you posted and have a working example here:



          https://codepen.io/justinthielman/pen/rQydjY



          I did not need to modify the HTML, only the CSS and JS code.






          share|improve this answer























          • Thanks man...it worked...Awesome.

            – Sankar S
            Nov 14 '18 at 16:19











          • No problem, glad it worked for you!

            – Justin T.
            Nov 14 '18 at 16:30















          0














          To do this, you would need to go through the CSS and look for important position properties to modify. In this case, there were several left positions that I changed to right. Also, in the JS code, you would need to modify the parameters of the animation to ensure the menu "moves" in the correct direction. I have modified the code you posted and have a working example here:



          https://codepen.io/justinthielman/pen/rQydjY



          I did not need to modify the HTML, only the CSS and JS code.






          share|improve this answer























          • Thanks man...it worked...Awesome.

            – Sankar S
            Nov 14 '18 at 16:19











          • No problem, glad it worked for you!

            – Justin T.
            Nov 14 '18 at 16:30













          0












          0








          0







          To do this, you would need to go through the CSS and look for important position properties to modify. In this case, there were several left positions that I changed to right. Also, in the JS code, you would need to modify the parameters of the animation to ensure the menu "moves" in the correct direction. I have modified the code you posted and have a working example here:



          https://codepen.io/justinthielman/pen/rQydjY



          I did not need to modify the HTML, only the CSS and JS code.






          share|improve this answer













          To do this, you would need to go through the CSS and look for important position properties to modify. In this case, there were several left positions that I changed to right. Also, in the JS code, you would need to modify the parameters of the animation to ensure the menu "moves" in the correct direction. I have modified the code you posted and have a working example here:



          https://codepen.io/justinthielman/pen/rQydjY



          I did not need to modify the HTML, only the CSS and JS code.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 13:23









          Justin T.Justin T.

          612413




          612413












          • Thanks man...it worked...Awesome.

            – Sankar S
            Nov 14 '18 at 16:19











          • No problem, glad it worked for you!

            – Justin T.
            Nov 14 '18 at 16:30

















          • Thanks man...it worked...Awesome.

            – Sankar S
            Nov 14 '18 at 16:19











          • No problem, glad it worked for you!

            – Justin T.
            Nov 14 '18 at 16:30
















          Thanks man...it worked...Awesome.

          – Sankar S
          Nov 14 '18 at 16:19





          Thanks man...it worked...Awesome.

          – Sankar S
          Nov 14 '18 at 16:19













          No problem, glad it worked for you!

          – Justin T.
          Nov 14 '18 at 16:30





          No problem, glad it worked for you!

          – Justin T.
          Nov 14 '18 at 16:30



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53281598%2fgreensock-gsap-hamburger-overlay%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

          Crossroads (UK TV series)

          ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế