jQuery fadeIn and fadeOut - swapping divs

后端 未结 6 1131
挽巷
挽巷 2021-01-25 19:33

I\'m new to jQuery and javascript in general but am plugging my way through thanks to sites like these.

I have a page with six hidden divs that are called with correspon

6条回答
  •  别那么骄傲
    2021-01-25 20:27

    Having your ids it might be like this:

    $.each([1,2,3,4,5,6], function(_, index) {
        $('#link' + index).click(function() {
            $('[id^=panel]').fadeOut('slow', function() {
                $('#panel' + index).fadeIn('slow');
            });
        })
    })
    

提交回复
热议问题