1.0.5 • Published 1 year ago

@bananin/bgaleria v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Galería

Bananin's Gallery

Install

In head tag

<script src="https://unpkg.com/@bananin/bgaleria@latest/js/b-galeria.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://unpkg.com/@bananin/bgaleria@latest/css/b-galeria.css" />

<!-- If you include youtube videos you will need to include the api so that it does not remain playing when you close it -->
<script src="https://www.youtube.com/iframe_api"></script>

Setting

Inside Html body:

<div class="my-5" id="app">
    <b-galeria :img="images" ref="gal" id="gal"></b-galeria>
    <div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 row-cols-lg-4">
        <div class="col" v-for="(i,e) in images">
            <img v-if="i.t=='i'" :src="i.s" class="img-gal" @click="this.$refs.gal.show(e)">
            <img v-if="i.t=='v'" :src="'https://img.youtube.com/vi/'+i.s+'/0.jpg'" class="img-gal" @click="this.$refs.gal.show(e)">
        </div>
    </div>
</div>

Javascript code:

const app = Vue.createApp({
    components: {
        "b-galeria": bGaleria
    },
    data() {
        return {
            images:[
                {s:"img/cara.png",t:"i"},
                {s:"img/cara.png",t:"i"},
                {s:"img/cara.png",t:"i"},
                {s:"DJgzyQX-yZQ",t:"v"}//youtube id
            ]
        };
    }
}).mount("#app");

#Options:

#Methods:

  • show(x=0): shows the gallery, x is optional and indicates which image should start to show.
  • hide(): hide the gallery
  • goTo(slide): move the gallery to the given position

Example in Galería con Bananin

License

MIT

Patrocinar

With your help I can continue paying the server <3

1.0.5

1 year ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.3

2 years ago

1.0.0

2 years ago