javascript - Flip Card with Greensock Tween and Safari -
i've found pen:
http://codepen.io/rhernando/pen/vjgxh
html
<div id="mainwrap"> <div class="cardcont"> <div class="cardback"></div> <div class="cardfront"></div> </div> <div class="cardcont"> <div class="cardback"></div> <div class="cardfront"></div> </div> <div class="cardcont"> <div class="cardback"></div> <div class="cardfront"></div> </div> </div> <div style="clear:both;"></div> <div id="mainwrap" style="margin-top:10px;"> <div class="cardcont"> <div class="cardback playcardback"></div> <div class="cardfront playcardfront"></div> </div> <div class="cardcont"> <div class="cardback playcardback"></div> <div class="cardfront playcardfront"></div> </div> <div class="cardcont"> <div class="cardback playcardback"></div> <div class="cardfront playcardfront"></div> </div> </div>
css
body { background:#444; } .cardcont { width:250px; height:400px; float:left; margin-right:10px; position:relative; /*border:solid 2px #fff;*/ } .cardfront, .cardback { position:absolute; width:250px; height:400px; background:url('http://s.cdpn.io/33073/lorempixel.jpg'); backface-visibility: hidden; -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; -ms-backface-visibility: hidden; } .cardback { background:url('http://s.cdpn.io/33073/lorempixe1l.jpg'); } .playcardfront { background:url("http://unlimitedpotentialnow.com/wp-content/uploads/2012/01/bouquet-cs.jpg"); } .playcardback { background:url("http://i203.photobucket.com/albums/aa158/comic1111/ace.png"); }
js
cssplugin.defaulttransformperspective = 1000; //we set backface tweenmax.set($(".cardback"), {rotationy:-180}); $.each($(".cardcont"), function(i,element) { var frontcard = $(this).children(".cardfront"), backcard = $(this).children(".cardback"), tl = new timelinemax({paused:true}); tl .to(frontcard, 1, {rotationy:180}) .to(backcard, 1, {rotationy:0},0) .to(element, .5, {z:50},0) .to(element, .5, {z:0},.5); element.animation = tl; }); $(".cardcont").hover(elover, elout); function elover() { this.animation.play(); } function elout() { this.animation.reverse(); }
that displays nice effect greensock. problem is not cross-browser beacuse doesn't work on safari.
could me understand why?
thanks
Comments
Post a Comment