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,
javascript greensock scrollmagic
add a comment |
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,
javascript greensock scrollmagic
add a comment |
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,
javascript greensock scrollmagic
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
javascript greensock scrollmagic
asked Nov 11 at 15:15
Andrew Spencer
62
62
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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