0
在這裏,而旋轉卡的文字翻轉,有沒有什麼辦法來解決它。我想過使用reverse()方法,但是文本是顛倒的。請幫幫我。我用了兩個函數使用jQuery hover()方法。如何避免字符串翻轉時卡旋轉
<!doctype html>
<html>
<head>
<style>
.card{
background-color:lightblue;
color:green;
line-height:70px;
text-align:center;
padding:10px;
width:100px;
height:100px;
transition: all 0.6s ease;
transform-style:preserve-3d;
border-radius:10px;
border:2px solid gray;
}
.card:hover{
transform:rotateZ(180deg);
background-color:orange;
color:purple;
direction:rtl;
}
.card-container{
perspective:1000px;
padding:10px;
}
</style>
</head>
<body>
<div class='container'>
<div class='card-container'>
<div class='card'>
<div class='front'>TEXT</div>
<div class='back'></div>
</div>
</div>
</div>
<script src='jquery.js'></script>
<script>
$(function(){
$('ul.parent >li').hover(function(){
$(this).find('ul.child').show(200);
},function(){
$(this).find('ul.child').hide(200);
});
});
//card hover and rotate
$('.card').hover(
function(){
$(this).find('.front').text('');
$(this).find('.back').text(('HELLO')); //hello is reversed when flipped <-----
},
function(){
$(this).find('.back').text('');
$(this).find('.front').text('TEXT');
});
</script>
</body>
</html>
按預期工作,請參閱[JSFiddle](http://jsfiddle.net/FPCRb/2240/) –