2017-11-11 6 views
1

クローンされた視差jqueryがdomに追加した後に機能しなくなります。 https://codepen.io/anon/pen/rYOrEOクローンを追加するJqueryが効果を停止します

HTML::

<div class="container"> 
    <a href="#" class="clone">Clone</a> 
</div> 
<section class="content"> 
    <div class="jumbotron text-center bg-faded my-5" style="background: url('http://lorempixel.com/1200/600/abstract/1') no-repeat center;" data-paroller-factor="0.5"> 
    <h1 class="heading-1 py-5 text-white">Hello Parallax!</h1> 
    </div> 
</section> 

JS: 私の例を確認してください

$(window).paroller(); 
$(function(){ 
    $('.clone').on('click', function() { 
    alert('hi'); 
    $(".jumbotron").clone().appendTo(".content"); 
    }); 
}); 

答えて

0

ちょうど

$('#grolsh').clone(); // Copies the element structure 

$('#grolsh').clone(true) // Copies both data and events along with the structure 

$('#grolsh').clone(true).off() // Copies both data and events and removes handlers 

Events bound with .on() and removed using .off(); 

Events bound with .bind() and removed using .unbind(); 

//更新されたコードを使用することができ、このヘルプ

ref

+0

これは機能していません。私のリンクをクリックしてください:codepen –

関連する問題