Лучший способ - получить позицию элемента, который вы хотите использовать в качестве ссылки.
Предположим #carrousel
в качестве элемента слайдера и #block
в качестве элемента, который вы хотите над ним (используя jQuery):
var ob = $('#carrousel').offset();
$('#block').css({ 'top': ob.top, 'left': ob.left }).show();
Это всего лишь пример. Возможно, вам придется выработать эти значения, чтобы получить именно то, что вы хотите. Обратите внимание, что вы должны создать #block
, но скрыть его с помощью css, чтобы он не показывался, пока не наступит "его время сиять".
РЕДАКТИРОВАТЬ : Рабочий пример:
CSS
#carrousel_text
{
position: absolute;
display: none;
z-index: 2000; // might need to be changed if you can't see it
top: 0;
left: 0;
width: 200px; // change to whatever you need
height: 100px; // change to whatever you need
background: red; // so that you can see what you're doing
}
JS
// the one you already have, do not creae another instance of jquery
jQuery(document).ready(function() {
// gets the top and left position of the #slideblock
var ob = $('#slideblock').offset();
// adds the top and left position to the #carrousel_text and shows it where you want it
// note that you'll have to sum or substract to ob.top and ob.left accordingly to what you visually need, e.g. untill it's in the right place.
$('#carrousel_text').css({ 'top': ob.top+50, 'left': ob.left+50 }).show();
Наконец, вы можете просто вставить свой #carrousel_text в разметку в любом месте, где вы хотите (это не имеет значения), и поместить в него другие элементы div, например:
<div id="carrousel_text">
<div id="cta_imgbox_learnmore">
<a id="cta_img_learnmore" href="#" title="Learn More"><span>Learn More</span></a>
</div>
<div id="img_boxout">
<p>Read our story and our methodology in crafting your custom home</p>
</div>
</div>