简体   繁体   English

AngularJS轮播:如何显示上一张和下一张图片的一部分

[英]AngularJS carousel: how to display part of previous and next images

How to show small parts of previous and next image in slideshow in AngularJS? 如何在AngularJS的幻灯片中显示上一张和下一张图像的一小部分? The parts of previous and next images should be displayed on desktop and tabet screens, but not on mobile 上一张和下一张图像的部分应显示在台式机和Tabet屏幕上,而不是移动设备上

This is what I already have: http://codepen.io/juliezzz/pen/qZezzx 这是我已经拥有的: http : //codepen.io/juliezzz/pen/qZezzx

<div ng-app="app">
<div ng-controller="CarouselDemoCtrl" id="slides_control">
<div>
  <carousel interval="myInterval">
    <slide ng-repeat="slide in slides" active="slide.active">
      <img ng-src="{{slide.image}}">
      <div class="carousel-caption">
        <h4>Slide {{$index+1}}</h4>
      </div>
    </slide>
  </carousel>
</div>

CSS: CSS:

#slides_control > div{
   height: 200px;
}
img{
   margin:auto;
   width: 800px;
}
#slides_control {
   width: 100%;
}

JavaScript 的JavaScript

 angular.module('app', ['ui.bootstrap']);
     function CarouselDemoCtrl($scope){
     $scope.myInterval = 3000;
     $scope.slides = [
         {
          image: 'http://lorempixel.com/400/200/'
         },
         {
         image: 'http://lorempixel.com/400/200/food'
         },
         {
         image: 'http://lorempixel.com/400/200/sports'
         },
         {
         image: 'http://lorempixel.com/400/200/people'
         }
       ];
     }

Take a look at https://github.com/angular-ui/bootstrap/blob/master/template/carousel/carousel.html 看看https://github.com/angular-ui/bootstrap/blob/master/template/carousel/carousel.html

You can modify the template of a carousel by using the templateUrl directive. 您可以使用templateUrl指令来修改轮播templateUrl

<carousel interval="myInterval" template-url="path-to-url">

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使twitter bootstrap 3轮播中心处于活动图像的中心,并显示下一张和上一张图像的一部分? - How can I make twitter bootstrap 3 carousel centre the active image and show part of the next and previous images? 具有下一个和上一个显示的无限轮播 - Infinite Carousel with next and previous display 如何在猫头鹰轮播中在屏幕上显示上一个和下一个滑块一半? - How to display the previous and next slider half on the screen in owl carousel? 引导轮播下一个和上一个图像不显示 - bootstrap carousel next and previous images not displaying 我如何创建一个在单击下一个和上一个按钮时滑动的旋转木马,旋转木马应该切换 div 而不是图像 - how do i create a carousel that slides on next and previous button click, the carousel should switch divs and not images 如何获取滑块中的图像数量并传递到AngularJS中的下一个/上一个函数? - How to get number of images in a slider and passing to next/previous function in AngularJS? 如何在轮播中将上一个和下一个图像嵌入上一个和下一个按钮 - How to embed the previous and next image in the previous and next button in a carousel 如何在 HTML 中创建一个轮播,并在左侧/右侧显示上一个/下一个图像? - How to create a carousel in HTML with previous/next images visible on left/right sides? 如何使图像轮播控件“下一个”和“上一个” - How to make Image Carousel Controls 'next' and 'previous' 如何在轮播中显示上一张和下一张幻灯片? - How to show on the carousel a piece of the previous and next slide?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM