jQueryの新機能は次のとおりです。WordPressブログのインデックスページで繰り返しクリックイベントが発生しない
これはブログのインデックスページなので、多くの繰り返しクラスがあります。 1つのブログ投稿画像をクリックしてクラスだけを追加して、そのコンテンツだけを表示する方法が必要です。それをするために管理されます。次に、公開されたコンテンツのボタンをクリックして、再び非表示にする必要があります。
私はクリックをアクティブなクラスを削除しようとしましたが、機能しませんでした。私はアクティブなウィンドウを非表示にするボタンを1回だけ得ることができました。基本的にそれは私がそれを望む方法で正確に動作しますが、各ブログ投稿ごとに1回だけです。
//clicking on a service circle makes it active and reveals its content
$('.service-circle').on('click',function(){
$('.service-circle').removeClass('active');
$(this).addClass('active');
});
//clicking on the close button hides content of active service circle
$('.close-button').on('click',function(){
$('.service-circle.active .hidden-content').hide();
});
テンプレートの設定は便利ですが、ここではあまりにということかどうか分からないのです。ここで
<div class="service-circle">
<div class="hidden-content">
<div class="close-button">X</div>
<?php the_content(); ?>
</div>
</div>
は、CSSです:
.service-circle {
width:100%;
-webkit-border-radius:50%;
-moz-border-radius:50%;
border-radius:50%;
float:left;
position:relative;
box-shadow:1px 1px 1px #ccc;
cursor:pointer !important;
}
.service-circle:after {
content:"";
display:block;
padding-bottom:100%;
}
.hidden-content {
display:block;
width:60%;
height:60%;
padding:0;
position:fixed;
z-index:9;
top:-100%;
left:-100%;
background:#f3f3f3;
box-shadow:1px 1px 2px 1px #999;
transition: all .5s ease-in-out;
-webkit-transition: all .5s ease-in-out;
-moz-transition: all .5s ease-in-out;
-o-transition: all .5s ease-in-out;
}
.service-circle.active .hidden-content {
top:20%;
left:20%;
transition: all .5s ease-in-out;
-webkit-transition: all .5s ease-in-out;
-moz-transition: all .5s ease-in-out;
-o-transition: all .5s ease-in-out;
}
.close-button {
width:50px;
height:50px;
background:#e86d1f;
-webkit-border-radius:50%;
-moz-border-radius:50%;
border-radius:50%;
position:absolute;
top:-25px;
right:-25px;
color:#fff;
font-weight:700;
line-height:50px;
font-size:25px;
cursor:pointer;
}
あなたのCSSのいくつかを共有できますか?伝道を考慮するために私の答えを変える必要があると思う。閉じるボタンをクリックすると、そのために2回発射されるかもしれません。 –
が追加されました。助けてくれてありがとう! –
乾杯。更新されたコードが登場しました! –