首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >图像和幻灯片视图的缩略图

问图像和幻灯片视图的缩略图
EN

Stack Overflow用户
提问于 2016-01-12 20:03:36
回答 2查看 1.5K关注 0票数 0

我想以缩略图的形式显示一组图像,点击图像时,它应该放大为幻灯片。如有任何建议,我们将不胜感激。目前我可以以幻灯片的形式查看图片。我想要一个缩略图视图。

EN

回答 2

Stack Overflow用户

发布于 2016-01-12 21:36:11

图像和幻灯片视图的缩略图

CSS

代码语言:javascript
复制
    .transparent {
      background: transparent !important;
    }
    .image-modal {
      width: 100% !important;
      height: 100%;
      top: 0 !important;
      left: 0 !important;
    }
    .fullscreen-image {
      max-width: 100%;
      max-height: 100%;
      bottom: 0;
      left: 0;
      margin: auto;
      overflow: auto;
      position: fixed;
      right: 0;
      top: 0;
    }
    .slider {
      width: 100%;
      height: 100%;
    }

    p.info {
      position: absolute;
      bottom: 55px;
      margin: 0 auto;
      width: 100%;
      display: block;
      text-align: center;
      font-size: 28px;
      color: #ffffff;
    }

    /* Fix modal backdrop for smaller devices */
    @media (max-width: 679px) {
      .active .modal-backdrop-bg {
        opacity: .5;
      }
      .modal-backdrop-bg {
        -webkit-transition: opacity 300ms ease-in-out;
        transition: opacity 300ms ease-in-out;
        background-color: #000;
        opacity: 0;
      }
    }

JAVASCRIPT

代码语言:javascript
复制
angular.module('ionicApp', ['ionic'])

    .controller('MainCtrl', ['$scope', '$ionicModal', '$ionicSlideBoxDelegate', function ($scope, $ionicModal, $ionicSlideBoxDelegate) {

        $scope.aImages = [{
            'src' : 'http://ionicframework.com/img/ionic-logo-blog.png', 
            'msg' : 'Swipe me to the left. Tap/click to close'
          }, {
            'src' : 'http://ionicframework.com/img/ionic_logo.svg', 
            'msg' : ''
          }, { 
            'src' : 'http://ionicframework.com/img/homepage/phones-weather-demo@2x.png', 
            'msg' : ''
        }, { 
            'src' : 'http://ionicframework.com/img/homepage/phones-weather-demo@2x.png', 
            'msg' : ''
        },{
            'src' : 'http://ionicframework.com/img/ionic-logo-blog.png', 
            'msg' : 'Swipe me to the left. Tap/click to close'
          }, {
            'src' : 'http://ionicframework.com/img/ionic_logo.svg', 
            'msg' : ''
          }, { 
            'src' : 'http://ionicframework.com/img/homepage/phones-weather-demo@2x.png', 
            'msg' : ''
        }, { 
            'src' : 'http://ionicframework.com/img/homepage/phones-weather-demo@2x.png', 
            'msg' : ''
        }];

        $ionicModal.fromTemplateUrl('image-modal.html', {
          scope: $scope,
          animation: 'slide-in-up'
        }).then(function(modal) {
          $scope.modal = modal;
        });

        $scope.openModal = function() {
          $ionicSlideBoxDelegate.slide(0);
          $scope.modal.show();
        };

        $scope.closeModal = function() {
          $scope.modal.hide();
        };

        // Cleanup the modal when we're done with it!
        $scope.$on('$destroy', function() {
          $scope.modal.remove();
        });
        // Execute action on hide modal
        $scope.$on('modal.hide', function() {
          // Execute action
        });
        // Execute action on remove modal
        $scope.$on('modal.removed', function() {
          // Execute action
        });
        $scope.$on('modal.shown', function() {
          console.log('Modal is shown!');
        });

        // Call this functions if you need to manually control the slides
        $scope.next = function() {
          $ionicSlideBoxDelegate.next();
        };

        $scope.previous = function() {
          $ionicSlideBoxDelegate.previous();
        };

        $scope.goToSlide = function(index) {
          $scope.modal.show();
          $ionicSlideBoxDelegate.slide(index);
        }

        // Called each time the slide changes
        $scope.slideChanged = function(index) {
          $scope.slideIndex = index;
        };
      }
    ]);

HTML

代码语言:javascript
复制
<ion-content class="has-header">
      <div class="row" style="flex-wrap: wrap;">
          <div class="col col-25" ng-repeat="image in aImages" style="border:1px solid #000;">
                <img ng-src="{{image.src}}" width="100%"  ng-click="goToSlide($index)" />
          </div>
      </div>
      <script id="image-modal.html" type="text/ng-template">
          <div class="modal image-modal transparent" 
               ng-click="closeModal()">
            <ion-slide-box on-slide-changed="slideChanged(index)" 
                           show-pager="false">
              <ion-slide ng-repeat="oImage in aImages">
                <img ng-src="{{oImage.src}}" class="fullscreen-image" />
                <p class="info">{{oImage.msg}}</p>
              </ion-slide>
            </ion-slide-box>
          </div>
      </script>
</ion-content>
票数 1
EN

Stack Overflow用户

发布于 2016-01-12 20:36:27

代码语言:javascript
复制
.thumbnail:hover {
position:relative;
top:-25px;
left:-35px;
width:500px;
height:auto;
display:block;
z-index:999;
}

refer to this link where you will get the thumbnail of image view for multiple images and add the thumbnail css to the image as a class like:

​

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34743208

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档