Scroll Magic Section Wipe height issue











up vote
1
down vote

favorite












I have implemented section wipes to some success, the issue I'm facing is for the first section, my content breaks when taller than the browser height. This is not an issue for the subsequent sections.



Fiddle – https://jsfiddle.net/apspencer/qsubj5ka/1/






console.clear();
console.log("ScrollMagic v%s loaded", ScrollMagic.version);


//add pannel# to each panel
$(".panel").each(function(i) {
$(this).addClass("panel" + (i + 1));
});

// how many panels
var numPanels = $('.panel').length;

// Add z-index and calulate tween durations
var orderedPanels = ;
var duration = ;
for (var i = 0; i < numPanels; i++) {
// generate CSS for z-index of each panel, negative numbers ascending
orderedPanels.push(".panel" + (i + 1) + " {z-index: " + (i + 1) + ";} ");
// Calulate tween duration for each panel based on height
duration.push(($(".panel" + (i+1)).height()/200));
}
// Add CSS for z-index of each panel to the head
$("<style id='panelZOrder' type='text/css'>" + (orderedPanels.join("")) + "</style>").appendTo("head");

// init
var controller = new ScrollMagic.Controller();

// define movement of panels
var wipeAnimation = new TimelineLite()
.fromTo(".panel1", duration[0], {
y: "-100%",
boxShadow: "0px 0px 0px 0px #000"
}, {
y: "-100%",
boxShadow: "0px 0px 200px 200px #000",
ease: Linear.easeNone
}).fromTo(".panel2", duration[1], {
y: "-0%",
boxShadow: "0px 0px 0px 0px #000"
}, {
y: "-100%",
boxShadow: "0px 0px 200px 200px #000",
ease: Linear.easeNone
}).fromTo(".panel3", duration[2], {
y: "-0%",
boxShadow: "0px 0px 0px 0px #000"
}, {
y: "-100%",
boxShadow: "0px 0px 200px 200px #000",
ease: Linear.easeNone
}).fromTo(".panel4", duration[3], {
y: "-0%",
boxShadow: "0px 0px 0px 0px #000"
}, {
y: "-100%",
boxShadow: "0px 0px 200px 200px #000",
ease: Linear.easeNone
}).fromTo(".panel5", duration[4], {
y: "-0%"
}, {
y: "-100%",
ease: Linear.easeNone
});


// create scene to pin and link animation
new ScrollMagic.Scene({
triggerElement: "#pinContainer",
triggerHook: "onLeave",
duration: "400%"
})
.setPin("#pinContainer")
.setTween(wipeAnimation)
.addIndicators() // add indicators (requires plugin)
.addTo(controller);





Thats the Javascript I'm using, I think it's something to do with the fact that the first y: is -100% whereas all the others are -0%, but changing this value to anything other than the -100% moves the page completely.



Thanks,










share|improve this question


























    up vote
    1
    down vote

    favorite












    I have implemented section wipes to some success, the issue I'm facing is for the first section, my content breaks when taller than the browser height. This is not an issue for the subsequent sections.



    Fiddle – https://jsfiddle.net/apspencer/qsubj5ka/1/






    console.clear();
    console.log("ScrollMagic v%s loaded", ScrollMagic.version);


    //add pannel# to each panel
    $(".panel").each(function(i) {
    $(this).addClass("panel" + (i + 1));
    });

    // how many panels
    var numPanels = $('.panel').length;

    // Add z-index and calulate tween durations
    var orderedPanels = ;
    var duration = ;
    for (var i = 0; i < numPanels; i++) {
    // generate CSS for z-index of each panel, negative numbers ascending
    orderedPanels.push(".panel" + (i + 1) + " {z-index: " + (i + 1) + ";} ");
    // Calulate tween duration for each panel based on height
    duration.push(($(".panel" + (i+1)).height()/200));
    }
    // Add CSS for z-index of each panel to the head
    $("<style id='panelZOrder' type='text/css'>" + (orderedPanels.join("")) + "</style>").appendTo("head");

    // init
    var controller = new ScrollMagic.Controller();

    // define movement of panels
    var wipeAnimation = new TimelineLite()
    .fromTo(".panel1", duration[0], {
    y: "-100%",
    boxShadow: "0px 0px 0px 0px #000"
    }, {
    y: "-100%",
    boxShadow: "0px 0px 200px 200px #000",
    ease: Linear.easeNone
    }).fromTo(".panel2", duration[1], {
    y: "-0%",
    boxShadow: "0px 0px 0px 0px #000"
    }, {
    y: "-100%",
    boxShadow: "0px 0px 200px 200px #000",
    ease: Linear.easeNone
    }).fromTo(".panel3", duration[2], {
    y: "-0%",
    boxShadow: "0px 0px 0px 0px #000"
    }, {
    y: "-100%",
    boxShadow: "0px 0px 200px 200px #000",
    ease: Linear.easeNone
    }).fromTo(".panel4", duration[3], {
    y: "-0%",
    boxShadow: "0px 0px 0px 0px #000"
    }, {
    y: "-100%",
    boxShadow: "0px 0px 200px 200px #000",
    ease: Linear.easeNone
    }).fromTo(".panel5", duration[4], {
    y: "-0%"
    }, {
    y: "-100%",
    ease: Linear.easeNone
    });


    // create scene to pin and link animation
    new ScrollMagic.Scene({
    triggerElement: "#pinContainer",
    triggerHook: "onLeave",
    duration: "400%"
    })
    .setPin("#pinContainer")
    .setTween(wipeAnimation)
    .addIndicators() // add indicators (requires plugin)
    .addTo(controller);





    Thats the Javascript I'm using, I think it's something to do with the fact that the first y: is -100% whereas all the others are -0%, but changing this value to anything other than the -100% moves the page completely.



    Thanks,










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have implemented section wipes to some success, the issue I'm facing is for the first section, my content breaks when taller than the browser height. This is not an issue for the subsequent sections.



      Fiddle – https://jsfiddle.net/apspencer/qsubj5ka/1/






      console.clear();
      console.log("ScrollMagic v%s loaded", ScrollMagic.version);


      //add pannel# to each panel
      $(".panel").each(function(i) {
      $(this).addClass("panel" + (i + 1));
      });

      // how many panels
      var numPanels = $('.panel').length;

      // Add z-index and calulate tween durations
      var orderedPanels = ;
      var duration = ;
      for (var i = 0; i < numPanels; i++) {
      // generate CSS for z-index of each panel, negative numbers ascending
      orderedPanels.push(".panel" + (i + 1) + " {z-index: " + (i + 1) + ";} ");
      // Calulate tween duration for each panel based on height
      duration.push(($(".panel" + (i+1)).height()/200));
      }
      // Add CSS for z-index of each panel to the head
      $("<style id='panelZOrder' type='text/css'>" + (orderedPanels.join("")) + "</style>").appendTo("head");

      // init
      var controller = new ScrollMagic.Controller();

      // define movement of panels
      var wipeAnimation = new TimelineLite()
      .fromTo(".panel1", duration[0], {
      y: "-100%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel2", duration[1], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel3", duration[2], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel4", duration[3], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel5", duration[4], {
      y: "-0%"
      }, {
      y: "-100%",
      ease: Linear.easeNone
      });


      // create scene to pin and link animation
      new ScrollMagic.Scene({
      triggerElement: "#pinContainer",
      triggerHook: "onLeave",
      duration: "400%"
      })
      .setPin("#pinContainer")
      .setTween(wipeAnimation)
      .addIndicators() // add indicators (requires plugin)
      .addTo(controller);





      Thats the Javascript I'm using, I think it's something to do with the fact that the first y: is -100% whereas all the others are -0%, but changing this value to anything other than the -100% moves the page completely.



      Thanks,










      share|improve this question













      I have implemented section wipes to some success, the issue I'm facing is for the first section, my content breaks when taller than the browser height. This is not an issue for the subsequent sections.



      Fiddle – https://jsfiddle.net/apspencer/qsubj5ka/1/






      console.clear();
      console.log("ScrollMagic v%s loaded", ScrollMagic.version);


      //add pannel# to each panel
      $(".panel").each(function(i) {
      $(this).addClass("panel" + (i + 1));
      });

      // how many panels
      var numPanels = $('.panel').length;

      // Add z-index and calulate tween durations
      var orderedPanels = ;
      var duration = ;
      for (var i = 0; i < numPanels; i++) {
      // generate CSS for z-index of each panel, negative numbers ascending
      orderedPanels.push(".panel" + (i + 1) + " {z-index: " + (i + 1) + ";} ");
      // Calulate tween duration for each panel based on height
      duration.push(($(".panel" + (i+1)).height()/200));
      }
      // Add CSS for z-index of each panel to the head
      $("<style id='panelZOrder' type='text/css'>" + (orderedPanels.join("")) + "</style>").appendTo("head");

      // init
      var controller = new ScrollMagic.Controller();

      // define movement of panels
      var wipeAnimation = new TimelineLite()
      .fromTo(".panel1", duration[0], {
      y: "-100%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel2", duration[1], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel3", duration[2], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel4", duration[3], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel5", duration[4], {
      y: "-0%"
      }, {
      y: "-100%",
      ease: Linear.easeNone
      });


      // create scene to pin and link animation
      new ScrollMagic.Scene({
      triggerElement: "#pinContainer",
      triggerHook: "onLeave",
      duration: "400%"
      })
      .setPin("#pinContainer")
      .setTween(wipeAnimation)
      .addIndicators() // add indicators (requires plugin)
      .addTo(controller);





      Thats the Javascript I'm using, I think it's something to do with the fact that the first y: is -100% whereas all the others are -0%, but changing this value to anything other than the -100% moves the page completely.



      Thanks,






      console.clear();
      console.log("ScrollMagic v%s loaded", ScrollMagic.version);


      //add pannel# to each panel
      $(".panel").each(function(i) {
      $(this).addClass("panel" + (i + 1));
      });

      // how many panels
      var numPanels = $('.panel').length;

      // Add z-index and calulate tween durations
      var orderedPanels = ;
      var duration = ;
      for (var i = 0; i < numPanels; i++) {
      // generate CSS for z-index of each panel, negative numbers ascending
      orderedPanels.push(".panel" + (i + 1) + " {z-index: " + (i + 1) + ";} ");
      // Calulate tween duration for each panel based on height
      duration.push(($(".panel" + (i+1)).height()/200));
      }
      // Add CSS for z-index of each panel to the head
      $("<style id='panelZOrder' type='text/css'>" + (orderedPanels.join("")) + "</style>").appendTo("head");

      // init
      var controller = new ScrollMagic.Controller();

      // define movement of panels
      var wipeAnimation = new TimelineLite()
      .fromTo(".panel1", duration[0], {
      y: "-100%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel2", duration[1], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel3", duration[2], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel4", duration[3], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel5", duration[4], {
      y: "-0%"
      }, {
      y: "-100%",
      ease: Linear.easeNone
      });


      // create scene to pin and link animation
      new ScrollMagic.Scene({
      triggerElement: "#pinContainer",
      triggerHook: "onLeave",
      duration: "400%"
      })
      .setPin("#pinContainer")
      .setTween(wipeAnimation)
      .addIndicators() // add indicators (requires plugin)
      .addTo(controller);





      console.clear();
      console.log("ScrollMagic v%s loaded", ScrollMagic.version);


      //add pannel# to each panel
      $(".panel").each(function(i) {
      $(this).addClass("panel" + (i + 1));
      });

      // how many panels
      var numPanels = $('.panel').length;

      // Add z-index and calulate tween durations
      var orderedPanels = ;
      var duration = ;
      for (var i = 0; i < numPanels; i++) {
      // generate CSS for z-index of each panel, negative numbers ascending
      orderedPanels.push(".panel" + (i + 1) + " {z-index: " + (i + 1) + ";} ");
      // Calulate tween duration for each panel based on height
      duration.push(($(".panel" + (i+1)).height()/200));
      }
      // Add CSS for z-index of each panel to the head
      $("<style id='panelZOrder' type='text/css'>" + (orderedPanels.join("")) + "</style>").appendTo("head");

      // init
      var controller = new ScrollMagic.Controller();

      // define movement of panels
      var wipeAnimation = new TimelineLite()
      .fromTo(".panel1", duration[0], {
      y: "-100%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel2", duration[1], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel3", duration[2], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel4", duration[3], {
      y: "-0%",
      boxShadow: "0px 0px 0px 0px #000"
      }, {
      y: "-100%",
      boxShadow: "0px 0px 200px 200px #000",
      ease: Linear.easeNone
      }).fromTo(".panel5", duration[4], {
      y: "-0%"
      }, {
      y: "-100%",
      ease: Linear.easeNone
      });


      // create scene to pin and link animation
      new ScrollMagic.Scene({
      triggerElement: "#pinContainer",
      triggerHook: "onLeave",
      duration: "400%"
      })
      .setPin("#pinContainer")
      .setTween(wipeAnimation)
      .addIndicators() // add indicators (requires plugin)
      .addTo(controller);






      javascript greensock scrollmagic






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 at 15:15









      Andrew Spencer

      62




      62





























          active

          oldest

          votes











          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',
          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%2f53250119%2fscroll-magic-section-wipe-height-issue%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f53250119%2fscroll-magic-section-wipe-height-issue%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

          Xamarin.iOS Cant Deploy on Iphone

          Glorious Revolution

          Dulmage-Mendelsohn matrix decomposition in Python