Git Product home page Git Product logo

hover-caption's Introduction

JQuery hover caption plugin.

Here’s a simple jQuery plugin that adds both a caption and a gray-out effect when hovering over an image. View the live demo.

How to make it work.

Drop these scripts in your header:

<script src="jquery-1.6.3.min.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.hover_caption.js" type="text/javascript" charset="utf-8"></script>

Call the plugin function on your images:

$(document).ready(function() {
   $('img').hover_caption();
});

Add this tiny bit of CSS somewhere:

.hover_caption {
   /* If you can count of CSS3 support: */
   background-color: rgba(0, 0, 0, 0.7);

   /* Or use a transparent image if you need to support bad browsers: */
   /* background-image: url(hover_caption_bg.png); */

   /* NOTE: If you're img elements have paddings or margins you'll need to
   match them here to get things lined up properly. */
}

Configuration options.

And here’s some configuration options:

$('img').hover_caption({
   caption_font_size: '18px',
   caption_color: 'white',
   caption_bold: true,
   caption_default: "Click for screenshots."
});

Smart captions.

If your image has a title attribute, the plugin will use that as the caption. Otherwise it will default to “Click for screenshots”. You can change the default if you like, of course.

hover-caption's People

Contributors

coryschires avatar

Watchers

 avatar  avatar

Forkers

rahulyhg

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.