Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 在索引文件中使用相同的.slideToggle效果_Jquery_Slidetoggle - Fatal编程技术网

Jquery 在索引文件中使用相同的.slideToggle效果

Jquery 在索引文件中使用相同的.slideToggle效果,jquery,slidetoggle,Jquery,Slidetoggle,我试图将相同的脚本应用到同一index.html文件中的2个案例中,但是当我更改z-index时。。。允许我一次只激活(应用/使用)一个效果 您可以在下使用结果 如果你想试试;请将代码放入超大jQuery插件中 我将非常感谢你的帮助。 提前通知我 HTML <!-- --------------- First DIV--------------- --> <footer> <div class="toggle-footer">About me<

我试图将相同的脚本应用到同一index.html文件中的2个案例中,但是当我更改z-index时。。。允许我一次只激活(应用/使用)一个效果

您可以在下使用结果 如果你想试试;请将代码放入超大jQuery插件中

我将非常感谢你的帮助。 提前通知我

HTML

<!-- --------------- First DIV--------------- -->

<footer>
    <div class="toggle-footer">About me</div>

    <div id="footer-content">
        <div id="footer-right">
            <ul class="lv">
                <li><a href="" id="home">Home</a></li>
                <li><a href="" id="about">About</a></li>
                <li><a href="" id="project">Project</a></li>
                <li><a href="" id="contact">Contact</a></li>
            </ul>
        </div>

        <div id="footer-left">
            <h3><a href="">XBO Design</a></h3>
        </div>
    </div>
</footer>


<!-- --------------- Second DIV --------------- -->
<news_footer>
    <div class="news_toggle_footer">menu</div>

    <div id="news_footer_content">
        <div id="news_footer_right">
            <ul class="lv">
                <li><a href="?page=home" id="home">Home</a></li>
                <li><a href="?page=about" id="about">About</a></li>
                <li><a href="?page=project" id="project">Project</a></li>
                <li><a href="?page=contact" id="contact">Contact</a></li>
            </ul>
        </div>

        <div id="news_footer_left">
            <h3><a href="?page=home">Scott Yetman Design</a></h3>
        </div>
    </div>
</news_footer>

您只需要一个
$(document).ready
函数。把两个脚本放在一个里面。嗨,Pbk!对不起,回信晚了。我已经解决了这个问题,但我一定会尝试你的建议来学习。干杯
<!-- --------------- First DIV--------------- -->
footer {
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    padding-bottom: 42px;
    z-index: 4;
}

#footer-content {
    display: none;  
}

#footer-left {
    width: 20%;
    height: 145px;
    float: left;
    ;
    opacity: 0.8;
    background-color: #A40000;
} 

#footer-left h3 a {
    color: #B2816E; 
    text-transform: lowercase;  
}

#footer-right {
    width: 80%;
    height: 145px;

    float: right;
    background:#000;
    opacity: 0.8;   
}

.toggle-footer {
    width: 60px;
    padding: 10px;
    cursor: pointer;
    text-align: center;
    opacity: 0.8;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    margin-left: 0px;
    font-size: small;

    color: #FFF;
    background-color: #A40000;
}

<!-- --------------- Second DIV --------------- -->

news_footer {
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    padding-bottom: 42px;
    z-index: 4;
}

#news_footer_content {
    display: none;  
}

#news_footer_left {
    width: 20%;
    height: 145px;  
    float: left;
    background-color: #5C4033;
    opacity: 0.8;
} 

#news_footer_left h3 a {
    color: #B2816E; 
    text-transform: lowercase;  
}

#news_footer_right {
    width: 80%;
    height: 145px;

    float: right;

    background-color: #B29F63;
    opacity: 0.8;   
}

.news_toggle_footer {
    width: 100px;
    margin: 0 auto;
    padding: 10px;

    cursor: pointer;

    text-align: center;

    background-color: #B29F63;
    opacity: 0.8;

    border-top-left-radius:  5px;
    border-top-right-radius: 5px;
}
jQuery(document).ready(function(){
    $(".toggle-footer").click(function(){
        $("#footer-content").slideToggle("slow");
    });
});


jQuery(document).ready(function(){
    $(".news_toggle_footer").click(function(){
        $("#news_footer_content").slideToggle("slow");
    });
});