Skip to content

Instantly share code, notes, and snippets.

@vimyum
Created September 6, 2017 14:48
Show Gist options
  • Save vimyum/d0c01a508b448da888b41084a0975db0 to your computer and use it in GitHub Desktop.
Save vimyum/d0c01a508b448da888b41084a0975db0 to your computer and use it in GitHub Desktop.
SpotLight JSS
ar toggle = false;
$('.searchlight')
.on('mousemove', function(event) {
$(this).addClass('on').css({'margin-left': event.pageX -150, 'margin-top': event.pageY -150});
})
.on('mouseout', function(event) {
$(this).removeClass('on');
})
.on('click', function() {
if (toggle) {
$(this).css('opacity', '0').css('cursor', 'auto');
} else {
$(this).css('opacity', '1').css('cursor', 'none');;
}
toggle = !toggle;
})
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment