私は、クリックするとdiv
で消える機能を作ろうとしており、それはdiv
に移動する必要があります。しかし、それは動作しません、最初のクリックdiv
が表示され、私はそこに移動するもう一度クリックする必要があります。 誰かが私を助けてくれますか? https://jsfiddle.net/qzdxf478/jQuery fadeInとdivに移動する
<a href="#princip-detail" class="showDetail">Continue</a>
<script>
$(document).ready(function() {
$('.showDetail').click(function() {
$('#princip-detail').fadeIn();
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
</script>
plsは私たちがあなたを助けるために、コードの一部が欠けているJsFiddleを作成します。Baldrá[email protected]/ –
を更新されたリンクは投稿にあります – hstur