MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / Gallery

Function Gallery

assets/js/imageGallery.js:2–44  ·  view source on GitHub ↗
(selector)

Source from the content-addressed store, hash-verified

1
2let Gallery = function(selector) {
3 isTrue = false;
4 this.argumens = arguments;
5 this.gallerySelector = document.querySelectorAll(selector);
6 this.activeImage; // active (open) image
7 this.bodyCover = document.createElement('div');
8
9 if (!document.querySelector('.body-cover')) {
10 document.body.appendChild(this.bodyCover);
11 this.bodyCover.classList.add('body-cover');
12 document.body.appendChild(this.bodyCover);
13 var bodyCoverDeps = `<div>
14
15 <div class="gallery-arrow next-btn">
16 <a href="#" class="next round">&#8250;</a>
17 </div>
18 <div class="gallery-arrow prev-btn">
19 <a href="#" class="previous round">&#8249;</a>
20 </div>
21 <a href="#" class="closeButton" >&times;</a>
22 </div>`;
23 bodyCoverDeps = document.createRange().createContextualFragment(bodyCoverDeps).firstElementChild
24 this.bodyCover.appendChild(bodyCoverDeps);
25 }
26
27 this.nextBtn = document.querySelector('.next-btn'); // next button
28 this.prevBtn = document.querySelector('.prev-btn'); // previous button
29 this.closeBtb = document.querySelector('.closeButton'); // close image button
30
31 this.gallerySequence = 0; // gallery
32 this.galleryItemSequence = 0; // gallery image
33
34 // Adding cols class
35 this.gallerySelector[0].classList.add(`cols-${this.argumens[1].cols}`);
36
37 // Original images
38 this.originalImages = {} // galleries with images
39
40 // init functions
41 this.generateItems();
42 this.closeImage();
43 this.styles();
44}
45//ON hovering at images
46$(document).ready(function(){
47 $(".fg-gallery img").hover(function(){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected