<script type="text/javascript">
            $(document).ready(function () {
                $(".two_middle1_li").mouseover(function () {
                    var str=$(this).attr("id");
                    if (str == "fzjs") {
                        $("#heiban_p1").fadeIn(1000);
                    }
                    else if (str == "snkjm") {
                        $("#heiban_p2").fadeIn(1000);
                    }
else if (str == "zygj") {
                        $("#heiban_p3").fadeIn(1000);
                    }
else if (str == "xgsy") {
                        $("#heiban_p4").fadeIn(1000);
                    }
else if (str == "zzjg") {
                        $("#heiban_p5").fadeIn(1000);
                    }                          
                })
$("li").mouseout(function () {
                    $("#heiban p").css("display", "none");
                });
            });
         
</script>
但是在列表快速上下移动鼠标会出现这种情况请问怎样才能解决呢?还有,就是我的内容只有文字,有没有其他方法只用一个div就能改变内容呢?
希望各位帮帮我,谢谢。javascriptdiv

解决方案 »

  1.   

    你要隐藏其他的内容先。。        $(".two_middle1_li").mouseover(function () {
                var str = $(this).attr("id");
                $('#heiban_p1,#heiban_p2,#heiban_p3,#heiban_p4,#heiban_p5').hide();/////
                if (str == "fzjs") {
                    $("#heiban_p1").fadeIn(1000);
                }
                else if (str == "snkjm") {
                    $("#heiban_p2").fadeIn(1000);
                }
                else if (str == "zygj") {
                    $("#heiban_p3").fadeIn(1000);
                }
                else if (str == "xgsy") {
                    $("#heiban_p4").fadeIn(1000);
                }
                else if (str == "zzjg") {
                    $("#heiban_p5").fadeIn(1000);
                }
            })
      

  2.   

    每个上面加个stop,用法自己查查。$("#heiban_p5").stop().fadeIn(1000);
      

  3.   

    345678910111213141516171819         $(".two_middle1_li").mouseover(function () {            var str = $(this).attr("id");            $('#heiban_p1,#heiban_p2,#heiban_p3,#heiban_p4,#heiban_p5').hide();/////            if (str == "fzjs") {                $("#heiban_p1").fadeIn(1000);            }            else if (str == "snkjm") {                $("#heiban_p2").fadeIn(1000);            }            else if (str == "zygj") {                $("#heiban_p3").fadeIn(1000);            }            else if (str == "xgsy") {                $("#heiban_p4").fadeIn(1000);            }            else if (str == "zzjg") {                $("#heiban_p5").fadeIn(1000);            }        }) 
      

  4.   


    这个不行,速度慢的时候可以,但快速上下划过列表还是会出现重叠的。
    我的DIV之前已经用display隐藏了
      

  5.   

    如果你想简单 就应该把名字起得有意义  必要起#heiban_p1 给他起个#heiban_fzjs
    <script type="text/javascript">
                $(document).ready(function () {
                    $(".two_middle1_li").mouseover(function () {
                        var str=$(this).attr("id");
                          $("#heiban_"+str).fadeIn(1000);
                    })
                    $("li").mouseout(function () {
                        $("#heiban p").css("display", "none");
                    });
                });
              
    </script>
      

  6.   


    问题解决了,要每个加.stop(true,true)才行
    $("#heiban_p5").stop(true,true).fadeIn(1000);
    感谢各位帮忙!