0

我有这种编码方式,它只是在单击链接时交换图像,我还显示了一些位于图像上的隐藏 html 内容。

 <script>
if($.browser.msie && parseInt($.browser.version) <= 6){
$('#contentone, #contenttwo, #contentthree, #contentfour, .linksBackground').hide();
}

$('#contentone, #contenttwo, #contentthree, #contentfour').hide();

$("#linkone").click(function() {
    $('#contenttwo, #contentthree, #contentfour').hide("1500");
    $("#imageone").attr("src","Resources/Images/TEMP-homeOne.jpg");
    $("#contentone").show("1500");
});
$("#linktwo").click(function() {
    $('#contentone, #contentthree, #contentfour').hide("1500");
    $("#imageone").attr("src","Resources/Images/TEMP-homeTwo.jpg");
    $("#contenttwo").show("1500");
});
$("#linkthree").click(function() {
    $('#contentone, #contenttwo, #contentfour').hide("1500");
    $("#imageone").attr("src","Resources/Images/TEMP-homeThree.jpg");
    $("#contentthree").show("1500");
});
$("#linkfour").click(function() {
    $('#contentone, #contenttwo, #contentthree').hide("1500");
    $("#imageone").attr("src","Resources/Images/TEMP-homeFour.jpg");
    $("#contentfour").show("1500");
});
</script>

有谁知道我如何进一步修改它以在用户滚动链接时显示一个小缩略图?

我只需要一个提示,因为我不知道该去哪里......我可以通过鼠标悬停来实现它吗?

4

1 回答 1

2

jQuery 有一个hover 方法,它结合了mouseover 和mouseout。您可以在链接中添加函数来检索缩略图并在鼠标悬停时显示它,然后在鼠标悬停时隐藏缩略图。

$('yourlink').hover(function(){
    // display the thumbnail
}, function(){
    // hide the thumbnail
});

您将需要在服务器上创建图像的缩略图(这可以自动完成,但您不要说您在那里使用哪种语言)。

或者,您可以只显示实际图像,但在显示时更改其尺寸以缩小它。请注意,如果这些是大图像,加载时间会很长。旧版本的 IE 不能很好地调整图像大小。考虑使用此技巧来实现平滑调整大小。

IE 中的双三次缩放

于 2010-05-27T11:26:08.007 回答