How to specify 2 different positions for Colorbox or Fancybox on the same page?

Posted by Eric on Stack Overflow See other posts from Stack Overflow or by Eric
Published on 2011-02-05T07:17:37Z Indexed on 2011/02/05 7:26 UTC
Read the original article Hit count: 139

Filed under:
|
|
|

I know this question has been asked before, but I'm having difficulty implementing it. I'm looking for a more specific answer. Here is my html code:

<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.4/jquery.min.js"></script>
<script src="../colorbox/jquery.colorbox.js"></script>
<script>
    $(document).ready(function(){
        //Examples of how to assign the ColorBox event to elements
        $(".example7").colorbox({width:"80%", height:"80%", iframe:true});
        $(".example7").colorbox({width:"80%", height:"80%", iframe:true});
    });
</script>
    </head>
    <body>  
     <p><a class='example7' href="http://google.com">Outside Webpage 1 (Iframe)</a></p>
     <p><a class='example7' href="http://google.com">Outside Webpage 2 (Iframe)</a></p>

(Excuse the wrong indentation - I had to mess with the formatting to get the body content to show up.)

Here is my CSS code(default colorbox code):

#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} #cboxOverlay{position:fixed; width:100%; height:100%;} #cboxMiddleLeft, #cboxBottomLeft{clear:left;} #cboxContent{position:relative; overflow:visible;} #cboxLoadedContent{overflow:auto;} #cboxLoadedContent iframe{display:block; width:100%; height:100%; border:0;} #cboxTitle{margin:0;} #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;} #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}

#cboxOverlay{background:#fff;}

#colorbox{} #cboxContent{margin-top:32px;} #cboxLoadedContent{background:#000; padding:1px;} #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} #cboxLoadingOverlay{background:#000;} #cboxTitle{position:absolute; top:-22px; left:0; color:#000;} #cboxCurrent{position:absolute; top:-22px; right:205px; text-indent:-9999px;} #cboxSlideshow, #cboxPrevious, #cboxNext, #cboxClose{text-indent:-9999px; width:20px; height:20px; position:absolute; top:-20px; background:url(images/controls.png) no-repeat 0 0;} #cboxPrevious{background-position:0px 0px; right:44px;} #cboxPrevious.hover{background-position:0px -25px;} #cboxNext{background-position:-25px 0px; right:22px;} #cboxNext.hover{background-position:-25px -25px;} #cboxClose{background-position:-50px 0px; right:0;} #cboxClose.hover{background-position:-50px -25px;} .cboxSlideshow_on #cboxPrevious, .cboxSlideshow_off #cboxPrevious{right:66px;} .cboxSlideshow_on #cboxSlideshow{background-position:-75px -25px; right:44px;} .cboxSlideshow_on #cboxSlideshow.hover{background-position:-100px -25px;} .cboxSlideshow_off #cboxSlideshow{background-position:-100px 0px; right:44px;} .cboxSlideshow_off #cboxSlideshow.hover{background-position:-75px -25px;}

Can someone please tell me how this can be achieved? Forgive my lack of css knowledge :) Any help would be greatly appreciated. Thanks a ton.

© Stack Overflow or respective owner

Related posts about css

Related posts about position