Giter VIP home page Giter VIP logo

bootstrap-magnify's Introduction

bootstrap-magnify

bootstrap-magnify is a small js plugin to enhance porte-folios and image galleries. It was inspired by [this pen] (http://codepen.io/scott23/pen/akKqc) on CodePen.io. I try to follow bootstrap js-plugin ethos but keep in mind that I'm not a good javascript programmer, so it's likely a bit messy.

What it does

This plugins adds a magnifying glass to images on mouseover. This is useful in porte-folios when you want to show details of your creation but you don't have the layout space to display your 1200px wide image.

The images used are large images, shown at a smaller resolution on the website, the magnifying glass shows a small part at the native resolution. Keep in mind that large images are heavy and you must not abuse from this technique.

Screenshot

If you want to show the large preview at a 200% ratio, just use an image twice the size of it's container.

How to use it in 3 easy steps

1. Add the styles

Import the css file in the head of your website

    <link rel="stylesheet" href="bootstrap-magnify.min.css">

Or import it at the end of your bootstrap.less file

    // ...

    // Magnifying glass
    @import "bootstrap-magnify.less"

2. Add the script

Import the script at the bottom of your page, after jQuery.

    <script src="js/bootstrap-magnify.min.js"></script>

3. Call the script

Now, there is two way you can trigger the functionality. The easy-way, which requires zero lines of javascript is using the data-api. Just add data-toggle="magnify" to your image like this:

    <img data-toggle="magnify" src="image.jpg" alt="">

Or, you can call it manually in javascript like this :

    $('.container img').magnify();

bootstrap-magnify's People

Contributors

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