Download
User Rating: 0.6/5 ( 1 votes)
Dim background is a jQuery plugin to dim the current page except for some user-defined top elements.
Source: github.com
1. INCLUDE JS FILES
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<script type="text/javascript" src="../jquery.dim-background.js"></script>
2. HTML
<div class="box">
<h2>Box #1</h2>
</div>
<div class="box">
<h2>Box #2</h2>
</div>
<div class="box">
<h2>Box #3</h2>
</div>
<div class="box">
<h2>Box #4</h2>
</div>
<div class="box" id="actionBox">
<h2>Box #5</h2>
<p>
Hover me!
</p>
</div>
<div class="box">
<h2>Box #6</h2>
</div>
3. JAVASCRIPT
$(function() {
$('#actionBox')
.mouseenter(function() {
$(this).dimBackground();
})
.mouseleave(function() {
$(this).undim(); // Note: We could also use `$.undim();`
});
});
4. OPTIONS
darkness : 0.75, // 0 means no dimming, 1 means completely dark
fadeInDuration : 300, // in ms
fadeOutDuration : 300, // in ms
curtainZIndex : 999