jQuery滑动切换帮助 [英] Jquery sliding toggle help

查看:71
本文介绍了jQuery滑动切换帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我陷入了一个问题.我已使用此jQuery代码以滑动效果切换2个div:

Hello everyone,
I am stuck with a problem. I have used this jQuery code for toggling 2 divs with a slide effect:

<script type=text/javascript>
    $(document).ready(function() {
        //hide the all of the element with class msg_body
        $(".msg_body", "litCategoryName").hide();
        //toggle the componenet with class msg_body
        $(".msg_head").click(function() {
            $(this).next(".msg_body").slideToggle(50);
        });
    });
</script>


它工作正常,但当有人展开和折叠2个div时,我也想显示+或-.
谁能指导我如何实现这一目标.


It''s working fine, but I want to display a + or - too when someone expands and collapses the 2 divs.
Can anyone guide me on how to achieve this.

Thanks in advance!

推荐答案

(document).ready(function(){ //使用msg_body
(document).ready(function() { //hide the all of the element with class msg_body


(.msg_body","litCategoryName").hide();隐藏所有元素. //使用类msg_body
(".msg_body", "litCategoryName").hide(); //toggle the componenet with class msg_body


(.msg_head").click(function(){
(".msg_head").click(function() {


这篇关于jQuery滑动切换帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆