开发者

Fancybox not working for multple IDs

开发者 https://www.devze.com 2023-02-19 20:02 出处:网络
OK so I\'m using Fancybox as a report feature. Click on the warn-logo and a fancybox will show up. So... naturally I\'ll just do this: <a id=\"various1\" href=\"#inline1\" class=\"<?=$a[\'id\']?

OK so I'm using Fancybox as a report feature. Click on the warn-logo and a fancybox will show up. So... naturally I'll just do this: <a id="various1" href="#inline1" class="<?=$a['id']?>"><img title="Report answer" src="images/icons/error.png" /></a> and it works... for the FIRST one only.. the rest don't show. Here's an SSCCE of my problem.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="imagetoolbar" content="no" />
    <title>FancyBox 1.3.4 | Demonstration</title>
    <script type="text/javascript" src="jquery-1.5.1.min.js"></script>
    <script type="text/javascript" src="scripts/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
    <script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
    <link rel="stylesheet" type="text/css" href="scripts/fancybox/jquery.fancybox-1.3.4.css" media="screen" />

    <link rel="stylesheet" href="style.css" />
    <script type="text/javascript">
        $(document).ready(function() {

            $("#various1").fancybox({
        'transitionIn'   :  'fade',
        'transitionOut'  :  'fade',
        'speedIn'        :  300, 
        'height': '300',
        'width': '300',
        'speedOut'       :  300, 
                'opacity'       : true,
                'centerOnScroll': true,
                'autoDimensions': false
            });

        });
    </script>



</head>
<body>

    <a id="various1" href="#inline1">Re开发者_如何学JAVAport 1</a> <br />
        <a id="various1" href="#inline1">Report 2</a> <br />
        <a id="various1" href="#inline1">Report 3</a> <br />


<div style="margin:0;padding:0;display:none;">
<div id="inline1" style="padding:0;marging-top:10px;">

<div class="header"><h3>Testing</h3></div>

Also... testing.

</div></div>    


</body>
</html>


An ID should only be used once per page. If you change those to classes it should work fine.

0

精彩评论

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