2010-02-03 72 views
0

嗨我正在嘗試使用Simple Modal插件工作,但是當我單擊鏈接時,對話框快速消失。我只是試圖讓一個簡單的對話框運行,如http://www.ericmmartin.com/projects/simplemodal/#examples所示。幫助使用SimpleModal插件(JQUERY)

請告知如何使其運行。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head> 

<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
    <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2'></script> 
    <script type='text/javascript' src='http://www.ericmmartin.com/wordpress/wp-content/themes/emm-v3/scripts/jquery.plugins.js?ver=1.0.2'></script> 
    <script type='text/javascript' src='http://www.ericmmartin.com/wordpress/wp-content/themes/emm-v3/scripts/jquery.simplemodal.js?ver=1.3.3'></script> 
    <script type="text/javascript"> 
$(document).ready(function() { 
    $("a").click(function() { 
     // Chained call with no options 
     $("#sample").modal(); 
    }); 
}); 
    </script> 

<title>hi</title> 
</head>  


<body> 
<a href="">Link</a> 

</body> 
</html> 

回答

3

您可以下載基本演示,並且您將有一個簡單的如何使用SimpleModal的例子。

http://www.ericmmartin.com/projects/simplemodal-demos/

順便說一句,請不要熱鏈接腳本在我的網站。

-Eric

+1

+1後解決 - 埃裏克,因爲你似乎可以用WordPress的,如果你有控制在您的'.htaccess'上,請參閱這裏瞭解如何輕鬆關閉熱鏈接:http://wpshout.com/a-to-z-of-wordpress-htaccess-hacks/ – 2010-05-21 00:58:09

0

您需要停止鏈接的默認功能。 所以你的代碼更改爲:

<script type="text/javascript"> 
    $(document).ready(function() { 
     $("a").click(function(evt) { 
      // Chained call with no options 
      $("#sample").modal(); 
      evt.preventDefault(); 
     }); 
    }); 
</script> 
0

我有同樣的問題和更新jQuery的1.8.3.js