Subliminal JavaScript

Ok. So this one's a little below the belt. Flashing a pop-up message very quickly to the user in an attempt to influence their behaviour. There's of course no evidence that it works but its fun to try at least...

 
 
var shown = false;
 
$(function(){
 
$('input:text').hover(function(){		   
 
if(!shown){
 
	var msg = "Buy me Beer";
 
	$('
<div>').css({position:'fixed',
					top:0,
                    left:0,
                    right:0,
                    bottom:0,
                    backgroundColor:'black',
                    color:'white',
                    fontSize:'100px',
                    textAlign:'center',
                    lineHeight:'400px'})
              .html(msg)
              .appendTo('body')
              .addClass('test');	
 
	setTimeout(function(){$('.test').remove()},20);
 
	shown = true;
 
	cls();
 
}
 
 });
 
});
 
function cls(){
 
	setTimeout(function(){ shown = false; },15000);	
 
}
 

In this example a black div is created, appended to the body and set to cover the content. The message is displayed in large white font, and a time-out set for 40 milliseconds to remove it again. A final time-out is set for 15 seconds to prevent the message from being triggered too often.

Here's a link if you're interested in running it, although I wouldn't follow it if you are sensitive to flashing images.
JS Subliminal Messages
I'll let you know how drunk I get off this.

This entry was posted in Development, jQuery. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>