Git Product home page Git Product logo

vibrancy.js's Introduction

vibrancy.js

A jQuery plugin for adding stylish frosted glass effects over images. Live Demo

Live Demo

http://dietrich-stein.github.io/vibrancy.js

Requirements

Usage

Add script tags to include the jQuery, CamanJS, and this library:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/camanjs/4.0.0/caman.full.min.js"></script>
<script src="jquery.vibrancy-0.1.min.js"></script>

Add HTML with any supported data- attributes on the child elements:

<div class="target">
	<div class="panel panel-1" data-vibrancy-vibrance="100" data-vibrancy-brightness="20" data-vibrancy-blur="100">
		The perfect design is now within your grasp.
	</div>
</div>

Add CSS to control the dimensions and positioning of your target and child elements:

.target {
	width: 800px;
	height: 533px;
}

.panel {
	position: absolute;
	z-index: 9000;
	box-sizing: border-box;
}

.target .panel-1 {
	font-size: 2em;
	color: #000;
	top: 30px;
	left: 30px;
	width: 392px;
	height: 108px;
	padding: 0.5em;
}

Call the plugin with the panelClass set to a CSS class shared by your child elements and the backgroundSrc set to URI reference of your desired background image:

$('.target').vibrancy({
	panelClass: 'panel',
	backgroundSrc: $('.hidden-preload img:first-child').attr('src')
})

Settings

Plugin Attribute Type Default Description
panelClass String 'panel' Determines the CSS class for selecting child elements.
backgroundSrc String '' URI reference to the image file to cache and display.
HTML5 Data Attribute Type Default Description
data-vibrancy-vibrance Integer 0 Determines the degree to which desaturated colors are made saturated.
data-vibrancy-brightness Integer 0 Determines the degree to which the brightness is increased.
data-vibrancy-blur Integer 0 Determines the intensity of the blur effect;

Feature Backlog

  • Support for more of the built-in filters provided by CamanJS
  • Setting to opt-in to the fading in of the <canvas> element
  • Setting to opt-in to caching for memory reduction
  • Data attribute to watch resizing on specific panels and re-render
  • Render canvas output off-screen and cache it to data URIs for faster rendering
  • Support for passing an <img> jQuery object or DOM element as the value of backgroundSrc
  • Support for responsive layouts

History

Check Releases for a detailed changelog.

Credits

Built on top of jQuery Boilerplate.

License

MIT License © Dietrich Stein

vibrancy.js's People

Contributors

dietrich-stein avatar

Stargazers

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