jQuery悬停为colorbox图像集合叠加

时间:2010-11-15 15:06:20

标签: jquery jquery-plugins colorbox

我最近遇到了使用colorbox或者 类似jquery lightbox插件,鼠标悬停功能 由jQuery悬停事件

触发

这似乎是一个使用$ .colorbox()并传递的好地方 收集作为REL参数,但我不能让它工作..

http://colorpowered.com/colorbox/

当我通过 href param 时,

.hover和colorbox会有效。 但仅适用于一张照片

<!DOCTYPE html>
<html lang="en">
    <head>
    <meta charset=utf-8 />
    <title>ColorBox Examples</title>
    <style type="text/css">
        body{font:12px/1.2 Verdana, Arial, san-serrif; padding:0 10px;}
        a:link, a:visited{text-decoration:none; color:#416CE5; border-bottom:1px solid #416CE5;}
        h2{font-size:13px; margin:15px 0 0 0;}
    </style>
    <link media="screen" rel="stylesheet" href="colorbox.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    <script src="./jquery.colorbox.js"></script>
    <script>
    $(document).ready(function(){

        $("[rel='example3']").hover( 
            function () { 
                $.colorbox({rel:"example3",width:"800",height:"800"}); 
                },  
            function () { 
                } 
            );

    });
    </script>
</head>
<body>

<h2>No Transition + fixed width and height (75% of screen size)</h2>
<p><a href="./content/ohoopee1.jpg" rel="example3"  title="Me and my grandfather on the Ohoopee 1.">Grouped Photo 1</a></p>
<p><a href="./content/ohoopee2.jpg" rel="example3"  title="Me and my grandfather on the Ohoopee 2.">Grouped Photo 1</a></p>

<p><a href="./content/ohoopee3.jpg" rel="example3"  title="Me and my grandfather on the Ohoopee 3.">Grouped Photo 1</a></p>

1 个答案:

答案 0 :(得分:1)

对这个问题感到抱歉..当我改变了我的思考方式时......答案变得清晰了...当然,colorbox在点击或鼠标悬停时效果很好......

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset=utf-8 />
    <title>ColorBox Examples</title>
    <style type="text/css">
        body{font:12px/1.2 Verdana, Arial, san-serrif; padding:0 10px;}
        a:link, a:visited{text-decoration:none; color:#416CE5; border-bottom:1px solid #416CE5;}
        h2{font-size:13px; margin:15px 0 0 0;}
    </style>
    <link media="screen" rel="stylesheet" href="colorbox.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    <script src="./jquery.colorbox.js"></script>
    <script>
    $(document).ready(function(){

    $('.example3').colorbox({rel:'example3',width:'75%',height:'75%'}).mouseover(function(){ $(this).click();  }); 

    });
    </script>
</head>
<body>

<h2>No Transition + fixed width and height (75% of screen size)</h2>
<p><a href="./content/ohoopee1.jpg" rel="example3" class="example3" title="Me and my grandfather on the Ohoopee 1.">Grouped Photo 1</a></p>
<p><a href="./content/ohoopee2.jpg" rel="example3" class="example3"  title="Me and my grandfather on the Ohoopee 2.">Grouped Photo 1</a></p>
<p><a href="./content/ohoopee3.jpg" rel="example3" class="example3"  title="Me and my grandfather on the Ohoopee 3.">Grouped Photo 1</a></p>

</body>
</html