On click slidetoggle div but hide others first - jQuery

后端 未结 5 1834
太阳男子
太阳男子 2021-02-06 13:06

I have a page that when a user clicks a title, the following div toggles display.

I want to somehow say if any other divs are display:block then set them to display non

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-06 13:36

    Try like below... it will work...

    Fiddle : http://jsfiddle.net/RYh7U/83/

        $(document).ready(function () {
            $('.office-title').next('div').slideToggle();
            $('.office-title').click(function(){   
            $('.office-title').next('div').slideUp();
            $(this).next('div').slideToggle(); 
            return false;
            });
         });
    

提交回复
热议问题