直接上code

<script type="text/javascript">
        $(function () {
            $('.spanfolder').click(function () {
                if(typeof($(this).siblings('.divfolder').css('background-position')) != 'undefined')//IE8下为undefined
                {
                    if ($(this).siblings('.divfolder').css('background-position') == "-80px -3px") {
                        $(this).siblings('.divfolder').css('background-position', '-64px -25px');
                        $(this).css('background-image', 'url(images/folder.gif)');
                    }
                    else {
                        $(this).siblings('.divfolder').css('background-position', '-80px -3px');
                        $(this).css('background-image', 'url(images/folder-closed.gif)');
                    }
                }
                else
                {
                    if ($(this).siblings('.divfolder').css('background-positionX') == "-80px") {
                        $(this).siblings('.divfolder').css('background-position', '-64px -25px');
                        $(this).css('background-image', 'url(images/folder.gif)');
                    }
                    else {
                        $(this).siblings('.divfolder').css('background-position', '-80px -3px');
                        $(this).css('background-image', 'url(images/folder-closed.gif)');
                    }
                }
                $(this).siblings('ul').slideToggle('fast');
            });
           
            });

    </script>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-12-14
  • 2021-08-27
  • 2021-07-13
  • 2021-06-26
猜你喜欢
  • 2021-12-21
  • 2022-01-23
  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案