0
"ボタン"と呼ばれる新しいスパンクラスを作りたいと思います。 「ボタン」をクリックすると、jQueryが実行され、「ボタン」ではなく.front
が反転します。私は試しました:$('.button').bind("click",function() {
しかし、それは.front
ではなくボタンにのみ影響します。jQuery:この機能を実行するために新しい "ボタン"を作る方法
HTML:
<span class="button">Run!</span>
のjQuery:
$(document).ready(function(){
$('.front').bind("click",function() {
// $(this) point to the clicked .front element (caching it in elem for speed):
var elem = $(this);
// data('flipped') is a flag we set when we flip the element:
if(elem.data('flipped'))
{
// If the element has already been flipped, use the revertFlip method
elem.revertFlip();
// Unsetting the flag:
elem.data('flipped',false)
}
else
{
// Using the flip method defined by the plugin:
elem.flip({
direction:'tb',
speed: 350,
onBefore: function(){
// Insert the contents of the .back div (hidden from view with display:none)
// into the clicked .front div before the flipping animation starts:
elem.html(elem.siblings('.back').html());
}
});
// Setting the flag:
elem.data('flipped',true);
}
});
});
ありがとう!これを試しましたが、elem.revertFlip();その後は機能しません。 –
OK、上記を更新しました。あなたがしようとしていることについてもう少し説明できますか? –
私は '実行します。 'を反転させます。 「
Hello World!
Run!
I am back
Run!