我有問題顯示鼠標懸停與自動定位大圖像。鼠標懸停時顯示右側和右側它的所有圖像出界,也需要額外的空間底部。 這是我的代碼。 在鼠標懸停時顯示大圖像與自動位置
$(document).ready(function() {
\t $('#portfolio li').click(function() {
\t \t // fetch the class of the clicked item
\t \t var ourClass = $(this).attr('class');
\t \t
\t \t // reset the active class on all the buttons
\t \t $('#filterOptions li').removeClass('active');
\t \t // update the active state on our clicked button
\t \t $(this).parent().addClass('active');
\t \t
\t \t if(ourClass == 'all') {
\t \t \t // show all our items
\t \t \t $('#portfolio').children('section.item').show(1000); \t
\t \t }
\t \t else {
\t \t \t // hide all elements that don't share ourClass
\t \t \t $('#portfolio').children('section:not(.' + ourClass + ')').hide(1000);
\t \t \t // show all elements that do share ourClass
\t \t \t $('#portfolio').children('section.' + ourClass).show(1000);
\t \t }
\t \t return false;
\t });
});
.Enlarge {
position:relative;
height:150px;
width:250px;
}
.Enlarge span {
position:absolute;
left: -9999px;
visibility: hidden;
opacity: 0;-webkit-transition: opacity 0.5s ease;
-moz-transition: opacity 1s ease;
-ms-transition: opacity 1s ease;
-o-transition: opacity 1s ease;
transition: opacity 1s ease;
}
div.Enlarge:hover{
z-index: 999;
cursor:pointer;
}
div.Enlarge:hover span{
visibility: visible;
opacity: 1;
top: 50px;
left: 0px;
width:500px;
height:300px;
padding: 5px;
background:#9f499b;
} \t
<section class="item brochure">
<div class="Enlarge">
small image 1
<span>large image 1</span>
</div>
</section>
<section class="item brochure">
<div class="Enlarge">
smal image 2
<span>large image 2</span>
</div>
</section>
<section class="item brochure">
<div class="Enlarge">
small image 3
<span>small image 3</span>
</div>
</section>
<section class="item brochure">
<div class="Enlarge">
small image 4
<span>large image 4</span>
</div>
</section>
但我想,如果我懸停圖像最右邊那麼它應該顯示懸停圖像自動左側因爲網站邊界。 – 2014-09-30 13:00:29
啊我看到了,我會在一秒內更新示例 – Snellface 2014-09-30 13:02:07
你可以看到圖像我給鏈接也讓你會更好地理解。 – 2014-09-30 13:05:11