Skip to content

Instantly share code, notes, and snippets.

@timruffles
Created March 2, 2012 16:23
Show Gist options
  • Select an option

  • Save timruffles/1959447 to your computer and use it in GitHub Desktop.

Select an option

Save timruffles/1959447 to your computer and use it in GitHub Desktop.
torch light in css
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(function() {
$(".masker").mousemove(function(e) {
$(this).css("-webkit-mask","-webkit-radial-gradient(" + e.clientX + " " + e.clientY + ", 170 120, rgba(0,0,0,0) 40%, rgba(0,0,0,1)) 10%")
})
})
</script>
<style type="text/css" media="screen">
.masker {
background: #000;
position: absolute;
width: 100%;
height: 100%;
z-index: 5;
}
.content {
height: 100%;
}
.item {
height: 100px;
width: 100px;
}
.one {
position: absolute;
top: 25%;
left: 25%;
background: red;
}
.wrap {
position: relative;
}
</style>
<div class="wrap">
<div class="masker">
</div>
<div class="content">
<div class="item one">Hello</div>
<div class="item two">Yovus</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment