由于某些原因,bootstrap不允许我以js为单位设置间隔时间。
我使用中间人为我的静态网站提供本地主机服务,而我似乎不能让js影响bootstrap中的转盘。我加载bootstrap和我的自定义js,如下所示
!!!
%html
%head
%title Save Rosie
%meta{charset: "utf-8"}/
/ Always force latest IE rendering engine or request Chrome Frame
%meta{content: "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}/
/ Use title if it's in the page YAML frontmatter
= stylesheet_link_tag "fonts", "all", "bootstrap"
= javascript_include_tag "jquery-1.11.0.min", "all", "bootstrap"
%body{class: page_classes}
= yield旋转木马功能齐全
.carousel.slide{ "data-ride" => "carousel" }
.carousel-inner
.item.active
%img{ :src => 'https://s3-us-west-2.amazonaws.com/rosiesdonations/Rosie1.png', :alt => "Rosie Picture one" }
.item
%img{ :src => 'https://s3-us-west-2.amazonaws.com/rosiesdonations/Rosie2.jpg', :alt => "Rosie Picture two" }
.item
%img{ :src => 'https://s3-us-west-2.amazonaws.com/rosiesdonations/Rosie3.jpg', :alt => "Rosie Picture three" }但是当我打电话给
$('.carousel').carousel({
interval: 2000
})在all.js中,它不会在2秒内切换,而是默认的5秒。
查找时出现错误:未捕获TypeError: Object object对象没有方法'carousel‘
我尝试先加载bootstrap,但它不起作用。
发布于 2014-03-19 17:06:44
发布于 2014-03-19 17:35:46
我不确定这是否会有问题,但尝试使用class="active"设置第一个轮播幻灯片项,然后以这种方式初始化轮播的js:
$(function(){
$('.carousel').carousel({
interval: 2000
});
});https://stackoverflow.com/questions/22500673
复制相似问题