admin管理员组文章数量:1297066
$('.carousel').carousel({
pause: true,
interval: false
});
I want to initialize this in a function but it is not working.
Is there any way to do this?
FYI I tried placing it in the document.ready
function.
$('.carousel').carousel({
pause: true,
interval: false
});
I want to initialize this in a function but it is not working.
Is there any way to do this?
FYI I tried placing it in the document.ready
function.
- thanks for the edit @JoseM :) – code0789 Commented Oct 6, 2015 at 3:53
2 Answers
Reset to default 7Remember you have to load the jquery.js
(library) file
and then load the bootstrap jquery file and then you custom js file.
Then call the carousel function like this
$('.carousel').carousel() // here carousel is the class of a div
add additional options like this
$( document ).ready(function(){
$('.carousel').carousel({
interval: 2000
})
});
If you are including this script within the html page, take care to see that you are including this function calling near the end of the html page.
You can initialize function in anywhere in function. But when you call same function again then it will be re-initialize. So keep it mind the re-initialization functionality.
本文标签:
版权声明:本文标题:javascript - Can I initialize bootstrap carousel in a function? or it should be done only in ready function? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741630497a2389333.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论