Reputation: 987
Is there any way I can position my colorbox relative to a parent div? I need it to appear to the right of a specific element and not in a position relative to the entire page.
Upvotes: 1
Views: 1641
Reputation: 9548
After the dom has loaded, you can move the #colorbox element. Example:
$('#colorbox').appendTo('#newElement');
Then, when you assign colorbox to an element, you'll want to specify a position instead of letting it try to center itself in the visitors viewport.
$('a.example').colorbox({top:0, right:0});
And of course your parent object will need to have positioning so that colorbox is positioned relative to it.
#newElement { position:relative; }
Upvotes: 2
Reputation: 993
<div id="outer" style="position: relative">
<div id="inner" style="positon: relative"></div>
</div>
Here #inner element is positioned relatively to #outer element. It means that you can make #outer element position absolute or fixed and place it where you want. #inner always will be relative to #outer.
Upvotes: 0