• Stars
    star
    197
  • Rank 197,722 (Top 4 %)
  • Language
    HTML
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Angular directive for nolimits4web/Swiper

angular-swiper

Directive that wraps nolimits4web/swiper library for AngularJS. License: Apache

1 Installation

bower install angular-swiper

2 Development

npm install -g gulp
npm install
bower install

3 Usage

3.1 Requirements

Add <script>s to your html files for angular and angular-swiper:

    <link rel="stylesheet" href="bower_components/swiper/dist/css/swiper.min.css">
    
    <script src="../bower_components/swiper/dist/js/swiper.js"></script>
    <script src="../bower_components/angular/angular.js"></script>
    <script src="../dist/angular-swiper.js"></script>

And add ksSwiper as a dependency for your app:

angular.module('myApp', ['ksSwiper', ...]);

3.2 Sample Markup

Example:

<ks-swiper-container initial-slide="3" loop="false" show-nav-buttons="false" slides-per-view="4" space-between="5" pagination-clickable="false">
    <ks-swiper-slide class="swiper-slide" ng-repeat="s in [1,2,3,4,5,6,7,8,9,10,11,12,13,14]">
        <img ng-src="http://api.randomuser.me/portraits/thumb/men/{{s}}.jpg">
    </ks-swiper-slide>
</ks-swiper-container>

3.3 Directive default values

If no attributes are given, an object with the following values will be used to initiate the swiper. It is possible to use the directive without specifying attributes.

// directive defaults
var params = {
    slidesPerView: $scope.slidesPerView || 1,
    slidesPerColumn: $scope.slidesPerColumn || 1,
    spaceBetween: $scope.spaceBetween || 0,
    direction: $scope.direction || 'horizontal',
    loop: $scope.loop || false,
    initialSlide: $scope.initialSlide || 0,
    showNavButtons: false
};

3.4 Possible Attributes

The following attributes can be used with this directive. Please see the Swiper API Documentation for more information about the type and description of parameters.

<ks-swiper-container
    slides-per-view="3"
    slides-per-column="1"
    space-between="0"
    pagination-is-active="true"
    pagination-clickable="false"
    show-nav-buttons="false"
    loop="false"
    autoplay="5000"
    initial-slide="0"
    direction="horizontal">
    ...
</ks-swiper-container>

3.5 Override any parameter

This allows you to pass a javascript object that will override any swiper parameter from the Swiper API Documentation that is used initialize swiper.

Example:

<ks-swiper-container override-parameters="{'effect':'cube'}">
    <ks-swiper-slide class="swiper-slide" ng-repeat="s in [1,2,3,4,5,6,7,8,9,10,11,12,13,14]">
      <img ng-src="http://api.randomuser.me/portraits/thumb/men/{{s}}.jpg">
    </ks-swiper-slide>
</ks-swiper-container>

3.6 Two-Way Binding of Swiper

In some situations it might be useful to access the actual swiper instance. Passing the parent scope will linked it to the model in the directive's isolated scope which is used for the swiper instance.

It can also be used to slideTo(index, speed, runCallbacks), slidePrev(runCallbacks, speed), slideNext(runCallbacks, speed) or for callback functions.

Example Template:

<div ng-controller="TestCtrl">
<ks-swiper-container swiper="swiper">
    <ks-swiper-slide class="swiper-slide" ng-repeat="s in [1,2,3,4,5,6,7,8,9,10,11,12,13,14]">
      <img ng-src="http://api.randomuser.me/portraits/thumb/men/{{s}}.jpg">
    </ks-swiper-slide>
</ks-swiper-container>
</div>

Example Controller

angular.module('swiperApp')
  .controller('TestCtrl', function($scope){

    $scope.swiper = {};

    $scope.next = function(){
      $scope.swiper.slideNext();
    };

  });

3.7 Accessing swiper object after it's created

In some situations, like when you wanna listen to swiper events, is useful to know when the swiper object is created (that occurs after all slides are created).

For that purpose is available the on-ready attribute. You can specify a function to be called when the swiper object is created. In the function you can manipulate the swiperobject, and for example, bind an event. The function must has a paramteter called swiper, refering to swiper object.

Example template

<div ng-controller="TestCtrl">
<ks-swiper-container swiper="swiper" on-ready="onReadySwiper(swiper)">
    <ks-swiper-slide class="swiper-slide" ng-repeat="s in [1,2,3,4,5,6,7,8,9,10,11,12,13,14]">
      <img ng-src="http://api.randomuser.me/portraits/thumb/men/{{s}}.jpg">
    </ks-swiper-slide>
</ks-swiper-container>
</div>

Example Controller

angular.module('swiperApp')
  .controller('TestCtrl', function($scope){

    $scope.swiper = {};

    $scope.onReadySwiper = function (swiper) {
      
      swiper.on('slideChangeStart', function () {
      
        console.log('slideChangeStart');
      });
    };

  });

More Repositories

1

rethinking-tensorflow-probability

Statistical Rethinking (2nd Ed) with Tensorflow Probability
Jupyter Notebook
269
star
2

opencv-mtcnn

An implementation of MTCNN Face detector using OpenCV's DNN module
C++
68
star
3

angular2-swing

angular 2 component for the swing library (https://github.com/gajus/swing)
TypeScript
62
star
4

angular2-swiper

Angular 2 Swiper component that wraps http://idangero.us/swiper
TypeScript
55
star
5

tensorflow-cc-examples

Tensorflow examples written in C++
CMake
43
star
6

dlib-to-tf-keras-converter

A set of scripts to convert dlib's face recognition network to tensorflow, keras, onnx etc
Jupyter Notebook
37
star
7

YATODO

Yet Another TODO application
35
star
8

langchain-graphrag

GraphRAG / From Local to Global: A Graph RAG Approach to Query-Focused Summarization
Python
29
star
9

ionic2-code-push-example

Example of how to use Microsoft CodePush with ionic2 and ionic-native
CSS
25
star
10

scikit-nni

AutoML - Hyper parameters search for scikit-learn pipelines using Microsoft NNI
Python
23
star
11

angular2-swiper-example

Example of how to use Swiper in angular 2 application
TypeScript
21
star
12

tiny-imagenet-tfds

tiny-imagenet dataset downloader & reader using tensorflow_datasets (tfds) api
Python
20
star
13

hyperledger-fabric-example

An example project to support blog posts on Bootstrapping a Hyperleder Fabric network
TypeScript
16
star
14

ngCordova-typescript-demo

Demo of Ionic 1.X using ngCordova written in Typescript
CSS
9
star
15

angular2-swing-example

Example showing how to use angular2-swing module
TypeScript
9
star
16

ftdi

GoLang bindings for FTDI MPSSE library (D2XX)
C
8
star
17

angular2-progressbar

Angular 2 component for progressbar.js
TypeScript
7
star
18

firebase-custom-auth-example

Custom authentication example for Firebase & AngularFire2
JavaScript
7
star
19

rxjs-zone-operators

Reactive extensions for Zones
TypeScript
5
star
20

deeplearn-examples

Examples using Deeplearn.js
TypeScript
5
star
21

tensorflow-cc-sdk-generator

Set of scripts to generate a CMake enabled tensorflow c++ SDK
Shell
4
star
22

tfjs-data-mnist

API for MNIST dataset built using tfjs-data
TypeScript
3
star
23

idea-manager

Record and share your ideas !
JavaScript
3
star
24

agilePLM

node module for Oracle Agile PLM
JavaScript
3
star
25

caf-playground

C++ Actor Framework Playground
Jupyter Notebook
3
star
26

face-embeddings-generator

A simple tool to generate face embeddings using dlib and/or facenet networks
Python
3
star
27

cordova-plugin-rx-ble

Cordova Plugin for Bluetooth Low Energy
Java
3
star
28

od-loss-exp

Some work to compare various object detection loss functions
Jupyter Notebook
3
star
29

RxSwiftMQTT

Reactive Extensions for MQTT in Swift
Swift
2
star
30

ionic2-code-push

CodePush support in Ionic 2 applications
TypeScript
2
star
31

angular2-store-saga-example

Example application showing how to use @ngrx/store & store-saga
JavaScript
2
star
32

angular2-progressbar-example

Example for using angular2-progressbar component
TypeScript
2
star
33

pkijs-node-example

An example app showing how to use PKIJS with nodejs
TypeScript
2
star
34

pc-ble-driver-js-examples

Examples of how to use pc-ble-driver-js node module
TypeScript
1
star
35

ml-in-hurry

Machine Learning in Hurry
Jupyter Notebook
1
star
36

node-docker-compose

Docker Compose API (not wrapper on python application) for NodeJS
TypeScript
1
star
37

tfjs-react

React components for tensorflow.js
TypeScript
1
star
38

Google-App-Engine-experiments

This repository contains various App Engine applications
Python
1
star