0

jQuery prettyPhotoプラグインを使用して、インライン html コンテンツを表示しています。このコンテンツには、prettyPhoto ポップアップを閉じてカスタム スクリプトを呼び出すためのリンクがあります。ポップアップは正常に動作しますが、どういうわけかリンクのクリック イベントが発生しません。これがコードです。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
    <meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
    <title>Development</title>
    <script src="js/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script src="js/jquery.prettyPhoto.js" type="text/javascript"></script>
    <link rel="stylesheet" href="css/prettyPhoto.css" type="text/css"/>
    <script type="text/javascript" charset="utf-8">
        $(document).ready(function(){
            $("#closeme").click( function (e){
                e.preventDefault();
                alert("closing popup");
                $.prettyPhoto().close();
                alert("do some othe stuff");
            });

            $("a[rel^='prettyPhoto']").prettyPhoto();

        });
    </script>
</head>
<body>
<a href="#inline-1" rel="prettyPhoto" >popop</a>
    <div id="inline-1" style="display:none;">
        <p>This is inline content opened in prettyPhoto.</p>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
        <a href="#" id="closeme">close</a>
    </div>
</body>
</html>

削除すると$("a[rel^='prettyPhoto']").prettyPhoto();、インライン HTML リンクのクリック イベントが正常に機能します。

誰でも問題を特定して修正するのを手伝ってもらえますか?

ありがとう、アミット・パテル

4

1 に答える 1