Coder Social home page Coder Social logo

ozturkkl / imgslides.js Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 11.59 MB

A basic image presentation tool with no external dependencies. Developed initially to display portraits. Responsive and easy to use.

Home Page: https://ozturkkl.github.io/ImgSlides.js/demo/index.html

License: MIT License

slider imageslider imageslideshow

imgslides.js's Introduction

imgSlides.js

A responsive easy to use image presentation tool with no external dependencies. Developed initially to display portraits.

image

Demo

Click here to view the demo.

Usage

Fist download the script file and the css file include them in your project.

<link rel="stylesheet" href="imgSlides.css">
<script src="imgSlides.js" defer></script>

Create a div element and add "imgSlides" class to it. Set it's width and height according to your preference. The slide will be responsive according to the size that is set for it.

<div class="imgSlides" id="my-image-slide-1">
    <img src="img/rx7-1.jpg" alt="picture of a car">
    <img src="img/rx7-2.jpg" alt="picture of a car">
    <img src="img/rx7-3.jpg" alt="picture of a car">
</div>

That's it, thanks for checking it out! :D

Other useful things to know:

  • You can append images directly into the div element and the code will automatically detect changes and re-initialize the imgSlide
const imgSlide = document.querySelector("#my-image-slide-1")

imgSlide.insertAdjacentHTML('beforeend', '<img src="img/rx7-1.jpg" alt="">');
imgSlide.insertAdjacentHTML('beforeend', '<img src="img/rx7-2.jpg" alt="">');
imgSlide.insertAdjacentHTML('beforeend', '<img src="img/rx7-3.jpg" alt="">');
  • You can empty the div to remove all the images and get an empty canvas.
const imgSlide = document.querySelector("#my-image-slide-1")
imgSlide.innerHTML = ''

// After emptying the imgSlides div element, code will detect the change and re-initialize the canvas. Will result in an empty slide canvas.
  • If you want to delete a certain image after the slide is initialized, you can find the images in #my-image-slide-1 .imgSlidesCanvas:
const images = document.querySelector("#my-image-slide-1 .imgSlidesCanvas")

console.log(images.children)
// Will return an HTML collection that has all the images. You can delete any image using this collection and the slide will update automatically.

License

This project is licensed under the MIT License.

imgslides.js's People

Contributors

ozturkkl avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.