Code Monkey home page Code Monkey logo

image-shadow's Introduction

Preview

Image and video shadow !

Simple and small Javascript script to display the shadow of the image!


Download

$ git clone https://github.com/tunguskha/Image-shadow

Import

Locally, choose one

<!-- Image shadow only -->
<script src="assets/js/image-shadow.min.js"></script>

<!-- Video shadow only -->
<script src="assets/js/video-shadow.min.js"></script>

<!-- Both -->
<script src="assets/js/image-video-shadow.min.js"></script>

CDN, choose one

<!-- Image shadow only -->
<script src="https://cdn.jsdelivr.net/gh/tunguskha/Image-shadow@latest/assets/js/image-shadow.min.js"></script>

<!-- Video shadow only -->
<script src="https://cdn.jsdelivr.net/gh/tunguskha/Image-shadow@latest/assets/js/video-shadow.min.js"></script>

<!-- Both -->
<script src="https://cdn.jsdelivr.net/gh/tunguskha/Image-shadow@latest/assets/js/image-video-shadow.min.js"></script>

Use it

All you need is .ishadow wrapper to the image and blur value in data attribute

<div class="ishadow">
  <img data-blur="20" src="your-image.jpg">
</div>

Also, you can make an element hoverable by adding data-hover="true".

false by default

<div class="ishadow">
  <img data-blur="20" data-hover="true" src="your-image.jpg">
</div>

If you use a lazy-loading script, srcset is supported.

<div class="ishadow">
  <img data-blur="20" srcset="your-image.jpg">
</div>

For video, it's a bit different

You also need a wrapper, called .v-shadow. Inside, import your video, control the blur like image-shadow, and dont forget to add a .v-clone class.

To work well, and control the shadow at the same time that the video is played, we have to clone it, and this is where the clone will be.

This may impact the performance of the site, which should be used with caution.

<div class="v-shadow">

  <video data-blur="20" controls>
    <source src="your-video.webm">
  </video>
	
  <div class="v-clone"></div>
	
</div>

Support

IE Edge Firefox Chrome Safari Opera
✔️ ✔️ ✔️ ✔️

See it live

Image-shadow

image-shadow's People

Contributors

imgbotapp avatar m-heyda avatar sebastianekstrom avatar tunguskha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.