Javascript 如何在jQuery切换中隔离div

Javascript 如何在jQuery切换中隔离div,javascript,Javascript,我试图暂停视差div并用静态图像替换它。下面的jQuery代码工作得很好,但它杀死了所有其他div(作为示例,我在下面的代码中只有一个额外的div)。如何在区域中隔离div <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Close to Working</title> <script src="//c

我试图暂停视差div并用静态图像替换它。下面的jQuery代码工作得很好,但它杀死了所有其他div(作为示例,我在下面的代码中只有一个额外的div)。如何在
区域中隔离div

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Close to Working</title>

    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <style>
        .parallax-layer {
            position:absolute;
        }
        .hundred {
            width:auto;
            height: 390px;
        }

    </style>
</head>

<body>
    <div style="background-color:rgba(0, 0, 0, 0.3)">
        <img src="./images/top_logo.png" alt="" />
    </div>
    <section>
        <button class='pushme'>Pause Sliding Images</button>
        <script>
            $(".pushme").click(function () {
                var $el = $(this);
                $el.text($el.text() == "Resume Sliding Images" ? "Pause Sliding Images": "Resume Sliding Images");
            });
        </script>
        <div class="hundred">
            <div id="port" style="position:relative;top:-15px;">
                <div style="left: 0%; margin-left: 0;" class="parallax-layer">
                    <div>
                    <img src="./images/para.png" alt="" class="fadeIn fadeIn-4s fadeIn-Delay-4s" />
                    </div>
                </div>
            </div>
        </div>
    </section>
    <div style="display: none"><img src="./images/ch_logo.png" alt=""/></div>
    <script>
        $( "button" ).click(function() {
            $( "div" ).toggle( "slow" );
        });
    </script>

    <script  type="text/javascript" src="para3_files/jquery_002.js"></script>
    <script type="text/javascript" src="para3_files/jquery_003.js"></script>
    <script type="text/javascript" src="para3_files/jquery.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function(xvalue){
            // Declare parallax on layers
            jQuery('.parallax-layer').parallax({
                mouseport: jQuery("#port"),
                yparallax: false
            });
        });
    </script>
    <script type="text/javascript" src="./js/home2.js"></script>
</body>
</html>

接近工作
.视差层{
位置:绝对位置;
}
.一百{
宽度:自动;
高度:390px;
}
暂停滑动图像
$(“.pushme”)。单击(函数(){
var$el=$(本);
$el.text($el.text()==“恢复滑动图像”?“暂停滑动图像”:“恢复滑动图像”);
});
$(“按钮”)。单击(函数(){
$(“div”)。切换(“慢速”);
});
jQuery(document).ready(函数(xvalue){
//声明层上的视差
jQuery('.parallax layer')。视差({
mouseport:jQuery(“端口”),
副视盘:假
});
});

如果您谈论的是
$(“div”)。切换(“slow”)
切换所有的
div
s,这是因为它就是这么做的


如果使用
$(“section div”)。切换(“slow”),它只会在
部分
s

内切换
div
s!我需要移动关闭,就是这样。非常感谢。我是一个老的*nix、BBX和PERL人,目标是一个嵌套,然后该嵌套中的元素的概念并不是什么新鲜事,然而,javascript语法对我来说是新的。你救了我很多小时的悲痛,是的,它工作得很好。