开发者

Help using SimpleModal plugin (JQUERY)

开发者 https://www.devze.com 2022-12-18 20:36 出处:网络
Hi I am trying to use the Simple Modal plugin working, but when I click the link, the dialog box comes and goes away quickly. I am just trying to get a simple dialog running as shown in http://www.eri

Hi I am trying to use the Simple Modal plugin working, but when I click the link, the dialog box comes and goes away quickly. I am just trying to get a simple dialog running as shown in http://www.ericmmartin.com/projects/simplemodal/#examples.

Please advise how to make it running.

<!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/wordpr开发者_JS百科ess/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>


You can download the basic demo and you will have a simple example of how to use SimpleModal.

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

BTW, please don't hot-link to the scripts on my site.

-Eric


you need to stop the link's default function. So change your code to:

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


I resolved this issue after updating jQuery to 1.8.3.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号