我的 js 中有这个:
$(function(){
    $('.slide:nth-child(11) .layout-100:first-child').click(function(){
        $('.slide:nth-child(11) .layout-100:first-child').fadeOut('slow');
        $('.slide:nth-child(11) .layout-100:nth-child(2)').fadeIn('slow');
    });
});
$(function(){
    $('.slide:nth-child(11) .layout-100:nth-child(2)').click(function(){
        $('.slide:nth-child(11) .layout-100:nth-child(2)').fadeOut('slow');
        $('.slide:nth-child(11) .layout-100:nth-child(3)').fadeIn('slow');
    });
});
...等等。
我有多个图像,我希望能够通过单击功能进行切换。但是我现在写下来的代码很多。有没有办法将它放入 1 个函数中?