티스토리 뷰

카테고리 없음

rollup(롤업)

James Wetzel 2014. 7. 17. 16:43
728x90
반응형

<script type="text/javascript">

        function rollup(containerID, ulID) {

            var $element = $('#' + containerID).find('#' + ulID);

            var $play = $('#' + containerID);

            var $stop = $('#' + containerID);

            var autoPlay = true;

            var auto = null;

            var speed = 2000;

            var timer = null;

            var first = false;

            var lastChild;


            lastChild = $element.children().eq(-1).clone(true);

            lastChild.prependTo($element);

            $element.children().eq(-1).remove();


            if (autoPlay) {

                timer = setInterval(moveNextSlide, speed);

                auto = true;

            }           


            function moveNextSlide() {

                $element.each(function(idx) {

                    var firstChild = $element.children().filter(':first-child').clone(true);

                    firstChild.appendTo($element.eq(idx));

                    $element.children().filter(':first-child').slideUp(300, function() { $(this).remove(); });

                });

            }

        }


        $(document).ready(function() {

            rollup("rollupWrapper", "rollupItem");

        });

    </script>

728x90
반응형