小编Naw*_*zSE的帖子

Bootstrap:在旋转木马的项目中的多个图像中仅滑动一个图像

我正在实现Bootstrap Carousel,用于在每个轮播项目中查看多个图像缩略图(4个图像).当我点击下一个或上一个控件时,它应该只滑出4个图像.我怎样才能实现这一点.

我已经尝试过skelly建议的这个例子,但是当我实现它时,在旋转木马上只显示一个图像,当我点击prev/next控件时,除了前一个图像之外,只显示了一个图像.我需要一直显示四张图像.如果左边的1张图像熄灭,那么同时应该从右边插入1张图像.我另外添加了"jquery/1.11.1/jquery.min.js"和"bootstrap-3.2.0-dist/bootstrap.js",但它没有用.

我实现的代码如下:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="./bootstrap-3.2.0-dist/js/bootstrap.js"></script>

<script type="text/javascript">
$('#myCarousel').carousel({
interval: 4000
})

$('.carousel .item').each(function(){
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));

for (var i=0;i<2;i++) {
next=next.next();
if (!next.length) {
  next = $(this).siblings(':first');
}

next.children(':first-child').clone().appendTo($(this));
}
});
</script>

<style type="text/css">
.carousel-inner .active.left { left: -25%; }
.carousel-inner .next        { left:  25%; }
.carousel-inner .prev    { left: -25%; }
.carousel-control        { width:  4%; }
.carousel-control.left,.carousel-control.right {margin-left:15px;background-image:none;}
</style>

</head>

<body> …
Run Code Online (Sandbox Code Playgroud)

twitter-bootstrap

6
推荐指数
1
解决办法
4万
查看次数

Java 8 Streams:将对象列表转换为一组对象

我正在尝试将对象列表转换为一组对象,以确保集合中不存在重复项。我正在尝试使用 Streams。

我有一个类产品如下:

class Product{  
int id;  
String name;  
float price;  
public Product(int id, String name, float price) {  
    this.id = id;  
    this.name = name;  
    this.price = price;  
}  
 public String getName()
 {
     return this.name;
 }
 public int getId()
 {
     return this.id;

 }
 public float getPrice()
 {
     return this.price;
 }
 public void setName(String name)
 {
     this.name = name;
 }
 public void setId(int id)
 {
     this.id = id;
 }
 public void getPrice(float price)
 {
     this.price = price;
 }
}  
Run Code Online (Sandbox Code Playgroud)

我正在尝试类似的东西:

   List<Product> …
Run Code Online (Sandbox Code Playgroud)

java java-8 java-stream

5
推荐指数
1
解决办法
1万
查看次数

什么是“高度:0;” 在 CSS 中是什么意思?

我正在使用一些旧的 css 代码。在许多地方,他们将 height 声明为height: 0; . 这个0是什么意思,它是什么单位?

谁能帮我吗。

html css

4
推荐指数
2
解决办法
7050
查看次数

标签 统计

css ×1

html ×1

java ×1

java-8 ×1

java-stream ×1

twitter-bootstrap ×1