您可以在懸停或在一段時間你喜歡
$(event.target).css("z-index","1000");
猜測這應該是這樣的,如果IM介意的Z-index設置爲1000吧:)
$(".clipartimage").on('click',function() {
$(this).width(100);
$(this).height(100);
$(this).css("z-index","1000");
});
我爲你做了懸停功能,保留舊圖像尺寸
// Vars to get old size back
var oldH = 0;
var oldW = 0;
$(".imagecontainer").hover(function() {
// Function for Hover Element
oldH = $('.clipartimage',this).height();
oldW = $('.clipartimage',this).width();
$('.clipartimage',this).width(300);
$('.clipartimage',this).height(200);
$('.clipartimage',this).css('z-index', 1000);
}, function(){
// Function for hover out
$('.clipartimage',this).width(oldW);
$('.clipartimage',this).height(oldH);
$('.clipartimage',this).css('z-index', 0);
});
這裏是一個演示http://jsfiddle.net/rfCkD/
修身版會是什麼樣
// Vars to get old size back
var oldH = 0;
var oldW = 0;
$(".imagecontainer").hover(function() {
// Function for Hover Element
oldH = $('.clipartimage',this).height();
oldW = $('.clipartimage',this).width();
$('.clipartimage',this).width(300).height(200).css('z-index', 1000);
}, function(){
// Function for hover out
$('.clipartimage',this).width(oldW).height(oldH).css('z-index', 0);
});
重要: 在你的情況賽義德您imagecontainer有:
.imagecontainer
{
float:left;
}
所以如果你想要你的圖片聽的z-index,你的圖像需要:你的容器上相對... 我希望這就是你要找的:)否則,你可能會尋找動畫:
.clipartimage
{
position:relative;
}
你也可以使用位置如果你想讓圖像騰出空間來觀看。
檢查此鏈接http://www.walkswithme.net/tag/image-zoom-plugin –