All Projects → David-Desmaisons → Vue.imagesloaded

David-Desmaisons / Vue.imagesloaded

Licence: mit
Vue.js 2.0 directive to detect images loading

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue.imagesloaded

Draggable Vue Directive
Vue2 directive that handles drag & drop
Stars: ✭ 286 (+113.43%)
Mutual labels:  directive, vue2
vue2-loading
vue-loading presented in Vue2
Stars: ✭ 15 (-88.81%)
Mutual labels:  directive, vue2
Vue Directive Tooltip
Vue.js tooltip directive. Easy to use, configure and style
Stars: ✭ 158 (+17.91%)
Mutual labels:  directive, vue2
Vuebar
(🗃️ Archived) Vue 2 directive for custom scrollbar that uses native scroll behavior. Lightweight, performant, customizable and without dependencies. Used successfully in production on https://ggather.com
Stars: ✭ 650 (+385.07%)
Mutual labels:  directive, vue2
Vue Datatables Net
Vue jQuery DataTables.net wrapper component
Stars: ✭ 119 (-11.19%)
Mutual labels:  vue2
Ngx Digit Only
An Angular directive to only allow [0-9] in the input box when typing, pasting or drag/dropping.
Stars: ✭ 107 (-20.15%)
Mutual labels:  directive
Multivisor
Centralized supervisor WebUI and CLI
Stars: ✭ 104 (-22.39%)
Mutual labels:  vue2
F Render
f-render | 基于 ElementUI 的表单设计器
Stars: ✭ 1,387 (+935.07%)
Mutual labels:  vue2
Vue Scroll Behavior
Customize the scrolling position on route navigation. Especially hash mode.
Stars: ✭ 132 (-1.49%)
Mutual labels:  vue2
Vue Online
A reactive offline indicator component for vue.js
Stars: ✭ 130 (-2.99%)
Mutual labels:  vue2
Vue Clipboard2
A simple vue2 binding to clipboard.js
Stars: ✭ 1,617 (+1106.72%)
Mutual labels:  vue2
Vue2 Element
基于vue2 + vue-router2 + element-ui + vuex2 + fetch + webpack2 企业级后台管理系统最佳实践
Stars: ✭ 112 (-16.42%)
Mutual labels:  vue2
V Dialogs
A simple and clean instructional dialog plugin for Vue2, dialog type including Modal, Alert, Mask and Toast
Stars: ✭ 121 (-9.7%)
Mutual labels:  vue2
Vue Cli Multipage Bootstrap
vue-cli-multipage-bootstrap demo with vue2+vue-router+vuex+bootstrap+markdown for learning vue2.0
Stars: ✭ 105 (-21.64%)
Mutual labels:  vue2
Vue Antd Pro
vue+ant-design-vue创建后台管理系统模板
Stars: ✭ 131 (-2.24%)
Mutual labels:  vue2
Seppf
普兰能效平台开源版(前端)
Stars: ✭ 104 (-22.39%)
Mutual labels:  vue2
Vue Ruby China
使用Vue.js框架搭建的ruby china山寨版,集成vue-router+vuex等
Stars: ✭ 113 (-15.67%)
Mutual labels:  vue2
Semantic Ui Vue2
Semantic UI Integration for Vue 2
Stars: ✭ 128 (-4.48%)
Mutual labels:  vue2
Vue Mobile Cli
🚀 Vue移动端多页应用脚手架
Stars: ✭ 112 (-16.42%)
Mutual labels:  vue2
Vue Easy Toast
A Toast widget for Vue 1 & 2
Stars: ✭ 112 (-16.42%)
Mutual labels:  vue2

Vue.ImagesLoaded

GitHub open issues GitHub closed issues Npm download Npm version vue2 MIT License

A Vue.js 2.0 directive to detect when images have been loaded, based on imagesLoaded

This directive allows to get a callback when children images are loaded in a container element.
Plays nicely with vue.isotope to allow re-layout when images are loaded.

Demo

demo gif

Typical usage

<div v-images-loaded:on.progress="imageProgress">
	<div v-for="element in list">
		<img :src="element.src">
	</div>
</div>
import imagesLoaded from 'vue-images-loaded'

export default {
    directives: {
        imagesLoaded
    },
    methods: {
        imageProgress(instance, image ) {
        const result = image.isLoaded ? 'loaded' : 'broken';
        console.log( 'image is ' + result + ' for ' + image.img.src );
    }

Isotope Example

<isotope ref="cpt" :options='getOptions()' v-images-loaded:on.progress="layout" :list="list">
    <div v-for="element in list" :key="element.id"  @click="selected=element">
        {{element.name}}
        <br>
        {{element.id}}
        <img :src="element.src" alt="Not found">
    </div>
</isotope>
import imagesLoaded from 'vue-images-loaded'

export default {
    directives: {
        imagesLoaded
    },
    methods: {
        layout () {
            this.$refs.cpt.layout('masonry');
        }     
    }

API

Using directive

  • When used without argument nor modifiers:
<div v-images-loaded:"loaded">

Directive value:

function loaded(instance){
    //...
}

loaded is a Function triggered after all images have been either loaded or confirmed broken.
Function parameter: ImagesLoaded instance

  • When used with on argument but no modifiers:
<div v-images-loaded.on:"listener">

Directive value:

listener:{
    done(instance){
        //...
    },
    fail(instance){
        //...
    }
}

listener is an Object containing callback functions.
Function should be named and will received arguments as described in Imagesloaded

  • When used with on argument and modifier:
<div v-images-loaded.on.progress:"callback">

Directive value:

function callback(instance, img){
    //...
}

callback is a Function triggered acording to modifier name always, done, fail, progress.
Function parameter: ImagesLoaded instance, and image information for progess only.

ImagesLoaded instance

  • Properties:
    • imagesLoaded.images

      Array of LoadingImage instances for each image detected

LoadingImage instance

  • Property:
    • LoadingImage.img

      Image - The img element

    • LoadingImage.isLoaded

      Boolean - true when the image has succesfully loaded

Installation

  • Available through bower and npm:
 npm install vue-images-loaded --save
 bower install vue.ImagesLoaded -save
  • For Modules

    // ES6
    import imagesLoaded from 'vue-images-loaded'
    ...
    export default {
          directives: {
              imagesLoaded,
          }
      ...
    
    // ES5
    var imagesLoaded = require('vue-images-loaded')
    
  • For <script> Include

    Just include vueimagesloaded.js after imagesloaded.pkgd.min.js script.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].