Giter Site home page Giter Site logo

ion2-image-slide's Introduction

Ionic Slide Zoom

Ionic slide with zoom modal

How To Use:

$ npm install ion2-image-slide --save

Then cd into app.ts:

import { SlideModule, SlideCmp } from 'ion2-image-slide';
@NgModule({
  imports: [
    xxx,
    SlideModule
  ],
  entrycomponents: [
    xxx,
    SlideCmp
  ]
})

Cd into your page:

  @ViewChild(Slides) slides: Slides;

  imgSlides: Array<any> = [
    {
      url: 'xxx.jpg'
    },
    {
      url: 'xxx.jpg'
    },
    {
      url: 'xxx.jpg'
    },
    {
      url: 'xxx.jpg'
    }
  ];

  constructor(private slideCtrl: SlideController){}

  slideUp(ev: any) {
    let currentIndex = this.slides._activeIndex;
    let slide = this.slideCtrl.create({
      ev: ev,
      list: this.imgSlides,
      index: currentIndex,
      change: this.changeCB.bind(this)
    });
    slide.present({
      ev: {
        data: ev,
        list: this.imgSlides,
        index: currentIndex,
        change: this.changeCB.bind(this)
      }
    });
  }

  changeCB(data: any) {
    this.slides.slideTo(data, 0);
  }

And the html template:

<div>
  <ion-slides>
    <ion-slide *ngFor="let slide of imgSlides">
      <img [src]="slide.url" (click)="slideUp($event)">
    </ion-slide>
  </ion-slides>
</div>

Substitute ios for android if not on a Mac.

ion2-image-slide's People

Contributors

jun1362008 avatar

Stargazers

 avatar Alin Capitanescu avatar Rannie avatar Jcdsr avatar  avatar JiaXin avatar  avatar wangCola avatar

Watchers

James Cloos avatar  avatar

Forkers

alincc

ion2-image-slide's Issues

Zoom is not working

Hey,

thank you very much for your work. I implemented this in my project and everything works fine except the zooming. I just have the slides with images but i am not able to zoom in. Do i have to add additional code to the one you explained in your readme ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.