- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在我的网页中将轮播实现为 slider 。它在 firefox 和移动浏览器(甚至 chrome)中完美运行。但它没有出现在 chrome 中。我不知道出了什么问题。我的语法是:
HTML:
<div class="carousel fade-carousel slide" data-ride="carousel" data-interval="4000" id="bs-carousel">
<!-- Overlay -->
<div class="overlay"></div>
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#bs-carousel" data-slide-to="0" class="active"></li>
<li data-target="#bs-carousel" data-slide-to="1"></li>
<li data-target="#bs-carousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item slides active">
<div class="slide-1"></div>
<div class="hero">
<hgroup>
<h1>Nepal's First</h1>
<h3>Nepal's first portal to buy authentic and verified refurbished Auto-mobiles.</h3>
</hgroup>
</div>
</div>
<div class="item slides">
<div class="slide-2"></div>
<div class="hero">
<hgroup>
<h1>Trusted Sellers</h1>
<h3>Buy from our authentic and verified recondition houses across the nation.</h3>
</hgroup>
</div>
</div>
<div class="item slides">
<div class="slide-3"></div>
<div class="hero">
<hgroup>
<h1>Tested</h1>
<h3>All listed vehicles tested and in well condition.</h3>
</hgroup>
</div>
</div>
</div>
</div>
CSS
/*
Fade content bs-carousel with hero headers
Code snippet by maridlcrmn (Follow me on Twitter @maridlcrmn) for Bootsnipp.com
Image credits: unsplash.com
*/
/********************************/
/* Fade Bs-carousel */
/********************************/
.fade-carousel {
position: relative;
height: 55vh;
}
.fade-carousel .carousel-inner .item {
height: 55vh;
}
.fade-carousel .carousel-indicators > li {
margin: 0 2px;
background-color: #f39c12;
border-color: #f39c12;
opacity: .7;
}
.fade-carousel .carousel-indicators > li.active {
width: 10px;
height: 10px;
opacity: 1;
}
/********************************/
/* Hero Headers */
/********************************/
.hero {
position: absolute;
top: 50%;
left: 50%;
z-index: 3;
color: #fff;
text-align: center;
text-transform: uppercase;
text-shadow: 1px 1px 0 rgba(0,0,0,.75);
-webkit-transform: translate3d(-50%,-50%,0);
-moz-transform: translate3d(-50%,-50%,0);
-ms-transform: translate3d(-50%,-50%,0);
-o-transform: translate3d(-50%,-50%,0);
transform: translate3d(-50%,-50%,0);
}
.hero h1 {
font-size: 6em;
font-weight: bold;
color: #d3d3d3d3;
margin: 0;
padding: 0;
}
.hero h3{
color:#cccccccc;
}
.fade-carousel .carousel-inner .item .hero {
opacity: 0;
-webkit-transition: 2s all ease-in-out .1s;
-moz-transition: 2s all ease-in-out .1s;
-ms-transition: 2s all ease-in-out .1s;
-o-transition: 2s all ease-in-out .1s;
transition: 2s all ease-in-out .1s;
}
.fade-carousel .carousel-inner .item.active .hero {
opacity: 1;
-webkit-transition: 2s all ease-in-out .1s;
-moz-transition: 2s all ease-in-out .1s;
-ms-transition: 2s all ease-in-out .1s;
-o-transition: 2s all ease-in-out .1s;
transition: 2s all ease-in-out .1s;
}
/********************************/
/* Overlay */
/********************************/
.overlay {
position: absolute;
width: 100%;
height: 100%;
z-index: 2;
background-color: #080d15;
opacity: .2;
}
/********************************/
/* Custom Buttons */
/********************************/
.btn.btn-lg {padding: 10px 40px;}
.btn.btn-hero,
.btn.btn-hero:hover,
.btn.btn-hero:focus {
color: #f5f5f5;
background-color: #1abc9c;
border-color: #1abc9c;
outline: none;
margin: 20px auto;
}
/********************************/
/* Slides backgrounds */
/********************************/
.fade-carousel .slides .slide-1,
.fade-carousel .slides .slide-2,
.fade-carousel .slides .slide-3 {
height: 55vh;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
}
.fade-carousel .slides .slide-1 {
background-image: url(../img/homepage-slider/nepalride-banner-1.jpg);;
}
.fade-carousel .slides .slide-2 {
background-image: url(../img/homepage-slider/nepalride-banner-2.jpg);;
}
.fade-carousel .slides .slide-3 {
background-image: url(../img/homepage-slider/nepalride-banner-3.jpg);;
}
/********************************/
/* Media Queries */
/********************************/
@media screen and (min-width: 980px){
.hero { width: 980px; }
}
@media screen and (max-width: 640px){
.hero h1 { font-size: 4em; }
}
谁能告诉我该怎么做?我在控制台中出现以下错误:
Uncaught TypeError: Cannot read property 'getContext' of null
at frontend.js:30
你可以在nepalride.com上看到详细信息
最佳答案
在dom中没有id为cline
的元素。您可以使用此 if 语句避免错误
if ($('#cline').length > 0) {
var cline = document.getElementById("cline").getContext("2d");
new Chart(cline).Line(lineChartData, {
responsive: true
});
}
祝你好运。C
关于javascript - Bootstrap Carousel 在 Chrome 中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43087312/
我用 Slick 创建了一个垂直旋转木马。我对设计进行了一些更改,除了第一个元素在旋转木马的视野中之外,一切都按我想要的方式工作。一次有 4 个项目在我的轮播中可见,但是当第一个元素位于四个项目中的第
例如,此问题主要发生在用户使用速度较慢的互联网或移动设备时。但是,当轮播中的页面内容/图像没有被缓存时,有时也会在更高的速度上看到闪烁。 如果页面加载并呈现第一个元素,所有轮播“幻灯片”就像一个列表一
当 Owl Carousel 在隐藏元素中启动,然后通过触发器显示该元素时,轮播项目的宽度完全错误(直到窗口调整大小): Fiddle (点击红色链接,看到损坏的布局出现,然后调整窗口大小) 这个问题
在构建轮播时,我意识到猫头鹰添加了克隆的重复项。我的猫头鹰配置看起来像这样。我如何阻止这种情况发生。 owlDfe.owlCarousel({ loop: false,
我正在为一家房地产公司开发一个网站,但我在使用 Bootstrap 的 Carousel 控件时遇到了问题。 我的目标是在一行中包含三个不同的列,并且每列中有一个 Carousel。我让它工作,问题是
我需要让我的 bootstrap 3 carousel-caption 占据我的一半 carousel,让 caption background-color 有点透明,并在其中写入一些文本。 所以逻辑
我正在使用引导媒体 slider 轮播。但是,如果项目少于 4 个,它会重复项目。我想每次点击滑动一个项目。 在下面查看我的代码 查询 $(document).ready(function()
关闭。这个问题需要 details or clarity 。它目前不接受答案。 想改进这个问题?添加详细信息并通过 editing this post 澄清问题。 4年前关闭。 社区在 29 天前审查
似乎默认情况下,Owl Carousel 将代表每张幻灯片的点放在旋转木马下方,而不是底部的内部。我发现我可以给它们添加负边距,它们会进入旋转木马,但它们落后于它有效地使它们变得无用。我想不出让它们出
基于本页 codrops 的代码:Codrops article ,我想将产品 slider 添加到 Bootstrap 轮播中。 I have added a codepen here 这是使瓶子动
我使用 React Bootstrap 轮播。指示器按钮未正确对齐,尺寸也不对。有办法解决这个问题吗? http://imgur.com/a/lhxMS
我很难弄清楚如何使用轮播,更具体地说是如何设置当前幻灯片。 这是文档 of the component 这是 fiddle Go First Go Second
Bootstrap 是否支持在 Carousel 中显示网格列或行而不是 carousel-item -s?这个想法是有一个复杂的网格列结构,它们可以像轮播元素一样相互交换。例如,如果我们有以下网格:
我正在使用 angular-ui bootstrap carousel 并想更改带有图像的左右导航链接。似乎在 tpl 中,它们被硬编码为 ‹ 和 › 有没有人对将这些更改为图像而不更改实际的 ang
React Slick 有没有办法在 Carousel 中包含 Carousel? import Slider from "react-slick";
如何用新的替换/重建 owl 轮播 项目? 描述 在许多情况下,例如当您从数据库中获取新数据时,您会在轮播中添加新数据,但在本示例中,我尝试用新数据替换所有项目。 $('.owl-carousel')
我在我的网站中实现了 Owl Carousel 2,我希望能够使用像这样提供的 Jumbpto 帮助程序跳转到特定幻灯片, $('.btnJump').click(function(){ $(
在轮播上开始拖动时,我无法在移动设备上滚动页面。因此,如果轮播占据了移动设备上的所有可见空间 - 向上/向下翻到页面会变得有点棘手...... 我如何禁用这种滚动的“拦截”? 最佳答案 将此 CSS
我在使用 Twitter Bootstrap Carousel 插件上的 .carousel(number) 方法时遇到问题。不知何故我无法让它工作。轮播本身已启动并正在运行,.carousel('n
我知道之前有人问过这个问题,但是相关的帖子在方法上有所不同,而且 fiddle 的例子也被删除了.. 我的情况:我在这里下载了整个 Bootstrap 表单: http://getbootstrap.
我是一名优秀的程序员,十分优秀!