cod*_*789 3 javascript css jquery twitter-bootstrap
$('.carousel').carousel({
pause: true,
interval: false
});
Run Code Online (Sandbox Code Playgroud)
我想在一个函数中初始化它,但它不起作用.
有没有办法做到这一点?
仅供参考我尝试将其放入document.ready
功能中.
请记住,您必须加载jquery.js
(库)文件
然后加载引导程序jquery文件,然后加载自定义js文件.
然后像这样调用轮播功能
$('.carousel').carousel() // here carousel is the class of a div
添加这样的其他选项
$( document ).ready(function(){
$('.carousel').carousel({
interval: 2000
})
});
Run Code Online (Sandbox Code Playgroud)
如果要在html页面中包含此脚本,请注意在html页面的末尾附近调用此函数.