js代码
<script src='js/stopExecutionOnTimeout.js?t=1'></script> <script src="js/jquery-2.1.1.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { var $demo = $('.demo'); var numOfSections = $('.demo__section').length; $(document).on('click', '.demo__menu-btn', function () { $demo.addClass('menu-active'); }); $(document).on('click', '.demo__close-menu', function () { $demo.removeClass('menu-active'); }); $(document).on('click', '.demo.menu-active .demo__section', function () { var $section = $(this); var index = +$section.data('section'); $('.demo__section.active').removeClass('active'); $('.demo__section.inactive').removeClass('inactive'); $section.addClass('active'); $demo.removeClass('menu-active'); for (var i = index + 1; i <= numOfSections; i++) { if (window.CP.shouldStopExecution(1)) { break; } $('.demo__section[data-section=' + i + ']').addClass('inactive'); } window.CP.exitedLoop(1); }); }); </script>
在线预览
资源均来自第三方,谨慎下载,前往第三方网站下载