2014-06-22 113 views
1

我想打開一個簡單的模式對話框,我一直在努力做到這一點。可以模態對話框。 - 混亂

任何人請幫忙嗎?這是HTML代碼(請刪除前)。這根本不起作用。

任何人都可以告訴**強烈的文字**我爲什麼?我還沒有得到那種我真的需要的輸出。

任何人都可以幫助我。在莊重的,彈出插件之前

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title></title> 
    <link href="css/magnific-popup.css" rel="stylesheet" /> 
    <script src="js/jquery.magnific-popup.js"></script> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" ></script> 
</head> 
<body> 


    <a class="popup-modal" href="#test-modal">Open modal</a> 

<div id="test-modal" class="white-popup-block mfp-hide"> 
    <h1>Modal dialog</h1> 
    <p>You won't be able to dismiss this by usual means (escape or 
     click button), but you can close it programatically based on 
     user choices or actions.</p> 
    <p><a class="popup-modal-dismiss" href="#">Dismiss</a></p> 
</div> 


    <script> 

     $(function() { 
      $('.popup-modal').magnificPopup({ 
       type: 'inline', 
       preloader: false, 
       focus: '#username', 
       modal: true 
      }); 
      $(document).on('click', '.popup-modal-dismiss', function (e) { 
       e.preventDefault(); 
       $.magnificPopup.close(); 
      }); 
     }); 

    </script> 

</body> 
</html> 

回答

1

加載jQuery的,它依靠的jQuery(我從來沒有用過,但我假設這樣seeeing,因爲它是預先附加withfixed「jQuery的」)

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title></title> 
    <link href="css/magnific-popup.css" rel="stylesheet" /> 
    <!-- Jquery loaded first here... --> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" ></script> 
    <!-- Plugins after... --> 
    <script src="js/jquery.magnific-popup.js"></script> 

</head> 
<body>