简体   繁体   中英

Jquery Waypoints : Multiple functions not working

I can only say that I testing waypoints and that as soon as I add a second function the first wont work anymore. Why is that?

$(document).ready(function() {
$(".black").waypoint(function(){
    TweenMax.to(this, 2, {right:"0", ease:Power2.easeInOut})       
},{offset:'50%'});

$(".white").waypoint(function(){
    TweenMax.to(this, 2, {left:"0", ease:Power2.easeInOut})       
},{offset:'50%'});

});

Try the following. I would be curious if the log will show its called more than once but the TweenMax is not able to execute multiple times.

$(document).ready(function() {
$(".black").waypoint(function(direction){
    console.log('BLACK');
    TweenMax.to(this, 2, {right:"0", ease:Power2.easeInOut})       
},{offset:'50%'});

$(".white").waypoint(function(direction){
    console.log('WHITE');
    TweenMax.to(this, 2, {left:"0", ease:Power2.easeInOut})       
},{offset:'50%'});

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM