0

Hi i am new to so so please ignore my errors on posting question.

I am using leanmodel.js for opening popup. it is working fine on my page but when i change the content of page using ajax call then leanmodel.js is not working.

<script type="text/javascript">
$(function() {
$('a[rel*=leanModal]').leanModal({ top : 100, closeButton: ".modal_close" });       
});
</script>

Edit :

I have put this code in a function and have called function after ajax success but unfortunately not working.

function myFunc(){
$('a[rel*=leanModal]').leanModal({ top : 100, closeButton: ".modal_close" });
}
4

2 回答 2

0

You can try using a delegate method such as

$(document).on('click', 'a[rel*=leanModal]', function(){

    $(this).leanModal({ top : 100, closeButton: ".modal_close" });

});   
于 2013-10-21T08:35:47.213 回答
0

我认为你需要在ajax成功后重新定义leanModal,比如:

https://stackoverflow.com/a/20110596/2144445

于 2013-11-21T03:07:15.280 回答