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

求解JQ代码~~~~
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="js/jquery-1.4.2.min.js"></script>
<script>
$(function(){
$("#touxiang").mousemove(function(){
$("#ttt").show();
})
})
</script>
<style type="text/css">
.tx_img{width:150px;}
.tx_img img{ float:left; max-width:140px; max-height:140px;}
.tx_list{position:absolute; left:0px; top:0px; z-index:100; width:170px; display:none; border:1px solid #ccc;}
.tx_img2{float:right; clear:right; width:10px; height:150px; background-color:#ccc;}
</style>
</head>

<body>
<div id="touxiang" class="tx_img">
<img src="images/untitled.bmp" />
</div>
<div id="ttt" class="tx_list">
<div class="tx_img2">
+
</div>
</div>

</body>
</html>
主要实现鼠标移上去显示灰色部分。就像是菜单一样悬停。鼠标移开灰色部分隐藏了

------解决方案--------------------
<script>
$(function () {
$("#touxiang").mousemove(function () {
$("#ttt").show();
});
$("#touxiang").mouseleave(function () {
$("#ttt").hide();
})
})
</script>
------解决方案--------------------
HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
        $("#imgLeave").mousemove(function (e) {
            $("#divDetails").css("top", e.pageY).css("left", e.pageX).show("slow");
        });

        $("#imgLeave").mouseleave(function () {
            $("#divDetails").hide();
        });
        $("#divDetails").mouseleave(function () {
            $("#divDetails").hide();
        });

 })
    </script>
</head>
<body>
    <img src="images/1.jpg" width="160" height="120" id="imgLeave"/>
    <div id="divDetails" style="display: none; position: absolute; border-color: Green;
        border-width: 1px; border-style: solid; background-color: Yellow;">
        <p>
            图片名称:扣扣秀</p>
        <p>
            所属人:无相</p>
    </div>
</body>
</html>

------解决方案--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="js/jquery-1.4.2.min.js"></script>
<script>
$(function(){
$("#touxiang").hover(function(){
$("#ttt").show();
},function(){$("#ttt").hide(