日期:2014-05-17  浏览次数:20531 次

鼠标经过小图显示大图和详细信息
本帖最后由 qiqishardgel 于 2013-04-16 11:11:13 编辑
我现在要实现一个效果是鼠标滑过小图时显示大图和详细信息,我在网上找了段代码
<style type="text/css">
.thumbnail{
position: relative;
z-index: 0;
}

.thumbnail:hover{
background-color: transparent;
z-index: 100;
}

.thumbnail span{
position: absolute;
background-color: lightyellow;
padding: 5px;
left: -600px;
border: 1px dashed gray;
visibility: hidden;
color: black;
text-decoration: none;
width:220px;
height:320px;
}

.thumbnail span img{
border-width: 0;
padding: 2px;
}

.thumbnail:hover span{
visibility: visible;
top: 0;
left: 60px;
}
</style>

<asp:DataList ID="DataList1" runat="server" RepeatColumns="9" RepeatDirection="Horizontal"
                CellSpacing="9">
                <ItemTemplate>
                    <a class="thumbnail" href="#thumb">
                   <img src="images/<%#Eval("product_img") %>" id="oimg" alt="" width="100px" height="100px" style="border:0" />
                   <span><img src="images/<%#Eval("product_img") %>" border="0" width="212px" height="212px"><br />测试测试测试
                   </span></a>
                </ItemTemplate>
            </asp:DataList>
这个实现的效果图如下:(如果看不见图片的就看链接地址)
/img/2013/04/27/11130774.jpg


现在我要在大图下再加上几个详细信息,像名称,价格之类的,就出现问题了
<asp:DataList ID="DataList1" runat="server" RepeatColumns="9" RepeatDirection="Horizontal"
                CellSpacing="9">
                <ItemTemplate>
                   <a class="thumbnail" href="#thumb">
                   <img src="images/<%#Eval("product_img") %>" id="oimg" alt="" width="100px" height="100px" style="border:0" />
                   <span><img src="images/<%#Eval("product_img") %>" border="0" width="212px" height="212px"><br />
                   <asp:Label ID="Label1" runat="server" Text='<%#Eval("product_name") %>' Font-Bold="true" Font-Size="14px" Fore