fancybox指令未对图像进行分组

fancybox directive not grouping images

本文关键字:图像 指令 fancybox      更新时间:2023-09-26

我已经为花式盒子创建了指令。它在花式框中打开图像,而不是对图像进行分组。我在Fancybox指令中检查了另一个解决方案,ng repeat不是对图像进行分组,但它们不会解决我的问题。

HTML:

<a fancybox class="fancybox" rel="group" data-thumbnail="http://fancyapps.com/fancybox/demo/2_s.jpg" href="{[{i.location}]}" title="{[{i.name}]}" width="460" height="298">
## Image ###<img src="{[{i.location}]}" alt="" width="460" height="298" />
</a>

JS花式盒子指令::

 App.directive('fancybox',function($compile, $timeout){
        return {
            link: function($scope, element, attrs) {
                alert('i am called');
                   element.fancybox({
                    openEffect : 'none',
                    closeEffect : 'none',
                    padding : 40,
                    margin : [20, 60, 20, 60] ,// Increase left/right margin
                    helpers: {
                    thumbs: {
                        width  : 40,
                        height : 40,
                        source  : function(current) {
                            return $(current.element).data('thumbnail');
                            }
                        }
                   },
                });
            }
         };
    });

我无法用fancybox实现它。无论如何,我改用引导转盘,引导更容易使用,

    <div ng-controller="CarouselDemoCtrl">
  <div style="height: 305px">
    <carousel interval="myInterval">
      <slide ng-repeat="slide in slides" active="slide.active">
        <img ng-src="{{slide.image}}" style="margin:auto;">
        <div class="carousel-caption">
          <h4>Slide {{$index}}</h4>
          <p>{{slide.text}}</p>
        </div>
      </slide>
    </carousel>
  </div>
  <div class="row">
    <div class="col-md-6">
      <button type="button" class="btn btn-info" ng-click="addSlide()">Add Slide</button>
    </div>
    <div class="col-md-6">
      Interval, in milliseconds: <input type="number" class="form-control" ng-model="myInterval">
      <br />Enter a negative number or 0 to stop the interval.
    </div>
  </div>
</div>

带角度的引导式旋转木马

我们可以在bootstrap提供的Carousel中进行大量定制。