0

由于我正在处理 jquery 滑块面板菜单并且我已经很好地实现了,但是当我向下单击 jquery 滑块菜单时,奇怪的问题仍然存在。例如检查这个链接(http://www.stickreloaded.com/demogame/simple-slide-panel.html#)见我下面的代码:

问候, phphunger。

<!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>Simple Slide Panel</title>

    <script type="text/javascript" src="jquery.js"></script>

    <script type="text/javascript">
    $(document).ready(function(){

        $(".btn-slide").click(function(){
            $("#panel").slideToggle("slow");
            $(this).toggleClass("active"); return false;
        });


    });
    </script>

    <style type="text/css">
    body {
        margin: 0 auto;
        padding: 0;
        width: 990px;
        font: 75%/120% Arial, Helvetica, sans-serif;
    }
    a:focus {
        outline: none;
    }
    #panel {
        background: #03111A;
        height: 180px;
        display: none;
    }
    .slide {
        margin: 0;
        padding: 0;
        border-top: solid 4px #ffc000;
        background: url(images/btn-slide.gif) no-repeat center top;
        /*background-color: #ffc000;
        height: 25px;
        width: 30px;
        -webkit-border-radius: 8px;
    -moz-border-radius: 8px; 
    border-radius: 8px;*/
    }
    .btn-slide {
        background: url(images/white-arrow.gif) no-repeat right -50px;
        /*background-color: #ffc000;
        -webkit-border-radius: 8px;
    -moz-border-radius: 8px; 
    border-radius: 8px;*/
        height: 25px;
        width: 30px;
        text-align: center;
        width: 144px;
        height: 31px;
        padding: 10px 10px 0 0;
        margin: 0 auto;
        display: block;
        font: bold 120%/100% Arial, Helvetica, sans-serif;
        color: #fff;
        text-decoration: none;
    }
    .active {
        background-position: right 12px;
    }
    .moreList{float:left;margin:20px 0 0 20px;width:150px;}
    .moreList li{margin-bottom:10px;}
    .moreList li a{color:#fff;font-size:14px;font-weight:bold;}
    .moreList li a:hover{color:#ee3524;}
    #wrapper{ margin: 0 auto;
    width: 1000px; height:auto; 
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px; 
    border-radius: 8px; 
    }
    /*#content{ background:#03111a; 
    -webkit-border-radius: 8px; 
    -moz-border-radius: 8px; 
    border-radius: 8px;                 
    margin-left: 5px; 
    margin-right: 5px; 
    margin-top: 10px; 
    margin-bottom: 5px; 
    overflow: hidden; }*/
    #content{
    background: #ff6801; /* Old browsers */
    -webkit-border-radius: 8px; 
    -moz-border-radius: 8px; 
    border-radius: 8px; 
    /* IE9 SVG, needs conditional override of 'filter' to 'none' */
    background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmNjgwMSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmNjMDAiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
    background: -moz-linear-gradient(top,  #ff6801 0%, #ffcc00 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ff6801), color-stop(100%,#ffcc00)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  #ff6801 0%,#ffcc00 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  #ff6801 0%,#ffcc00 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  #ff6801 0%,#ffcc00 100%); /* IE10+ */
    background: linear-gradient(to bottom,  #ff6801 0%,#ffcc00 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff6801', endColorstr='#ffcc00',GradientType=0 ); /* IE6-8 */
    }
    </style>
    </head>

    <body>

    <div id="panel">
        <!-- you can put content here -->
        <ul class="moreList">
            <li><a href="#" id="tag_stick-figure" class="navTagLink">Ben 10</a></li>

            <li><a href="#" id="tag_naughty" class="navTagLink">Batman</a></li>

            <li><a href="#" id="tag_fighting" class="navTagLink">Spongebob</a></li>

            <li><a href="#" id="tag_bloody" class="navTagLink">Scooby Doo</a></li>

            <li><a href="#" id="tag_word" class="navTagLink">Power Rangers</a></li>

            <li><a href="#" id="tag_political" class="navTagLink">Transformers</a></li>

        </ul>
            <ul class="moreList">
        <li><a href="#" id="tag_racing" class="navTagLink">Pokemon</a></li>

            <li><a href="#" id="tag_motorsports" class="navTagLink">Avatar</a></li>
            <li><a href="#" id="tag_flying" class="navTagLink">Mario</a></li>

            <li><a href="#" id="tag_easy" class="navTagLink">Sonic</a></li>
            <li><a href="#" id="tag_high-score" class="navTagLink">Naruto</a></li>

            <li><a href="#" id="tag_map" class="navTagLink">Johnny Bravo</a></li>

            </ul>

            <ul class="moreList">
            <li><a href="#" id="tag_escape" class="navTagLink">Escape</a></li>

            <li><a href="#" id="tag_tycoon" class="navTagLink">Tycoon</a></li>

            <li><a href="#" id="tag_tower-defense" class="navTagLink">Tower Defense</a></li>

            <li><a href="#" id="tag_random" class="navTagLink">Random</a></li>
    <li><a href="#" id="tag_gross" class="navTagLink">Fighting</a></li>

            <li><a href="#" id="tag_zombie" class="navTagLink">Shooting</a></li>

        </ul>

            <ul class="moreList">
            <li><a href="#" id="tag_hard" class="navTagLink">Spiderman</a></li>

            <li><a href="#" id="tag_make-your-own" class="navTagLink">Billy and Mandy</a></li>

            <li><a href="#" id="tag_dress-up" class="navTagLink">Flintstones</a></li>

            <li><a href="#" id="tag_high-school" class="navTagLink">Looney Tunes</a></li>
            <li><a href="#" id="tag_celebrity" class="navTagLink">Action</a></li>

            <li><a href="#" id="tag_cute" class="navTagLink">Racing</a></li>



        </ul>


    </div>

    <p class="slide"><a href="#" class="btn-slide">More Games</a></p>

    <div id='wrapper'>
    <div id='content'>
    <div style="height: 450px;">
    </div>
    </div>
    </div>

    </body>
    </html>
4

1 回答 1

0

虽然我无法复制它,但我想我以前遇到过这个问题。

#panel尝试在div上添加以像素为单位的固定宽度(它不能在 % 或 em 中)。

这可以防止一个不寻常的 jQuery 错误,当手风琴向下滑动时它会跳跃/跳过(当它到达底部时)。

于 2013-02-19T11:39:30.173 回答