js代码
<script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/index.js"></script> <script type="text/javascript"> var setting = { width:1000, height:270, postWidth:658, postHeight:270, scale:0.8, speed:500, verticalAlign:"center" } $(".carousel").attr("data-setting",'{ "width":900,"height":411,"postWidth":658}') Carousel.init($(".carousel")) </script>