js代码
<script type="text/javascript" src="js/jquery-2.1.4.js"></script> <script type="text/javascript" src="js/bootstrap.min.js"></script> <script type="text/javascript" src="js/index.js"></script> <script type="text/javascript" src="js/stopExecutionOnTimeout.js"></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); }); //3D转换图片切换 $(".img-container").on("click", "button", function() { var index = $(this).data("index"); $(".img-block").find("img").attr("src", "img/"+index+".png"); }); }); </script>