A nice title show with mouse move plugin using JQuery

<!–

This plugin will show you a nice mouseover short description of any element of your web page.You can modify it according to your wish.All you have to do just use the showtitle() method that i created like i use(see the example below).
You can change the background color or border or padding etc.

If you use the showtitle() method and however you don’t use any title attribute in the selector tag there will show nothing.

showtitle.js file contains the plugin ….

–>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
<script type=”text/javascript” src=”jquery.js”></script>
<script type=”text/javascript” src=”showtitle.js”></script>
<script type=”text/javascript”>
$(document).ready(function(){

$(‘input[type=”button”]’).showtitle();

});
</script>
<style type=”text/css”>
#title_design
{
background-color:#D3EFF8;
position:absolute;
padding:3px;
height:auto;
width:auto;
border:2px inset #99EACC;
display:none;
}
</style>
</head>

<body>
<input type=”button” value=”Check Out” title=”This is button no. 1″/>
<input type=”button” value=”Check Out” title=”This is button no. 2″/>
</body>
</html>

===================================================
showtitle.js

(function($){

$.fn.showtitle = function(){

var title;
$(this).after(‘<div id=”title_design”></div>’);

$(this).mouseover(function(){

title = $(this).attr(‘title’);
$(this).removeAttr(‘title’);
$(this).mousemove(function(e){

$(‘#title_design’).css({‘top’:e.clientY+10+’px’,’left’:e.clientX+10+’px’});
$(‘#title_design’).text(title).show();

});

}).mouseout(function(){

$(this).attr(‘title’,title);
$(‘#title_design’).hide();
});

}

})(jQuery)

Advertisements

One comment on “A nice title show with mouse move plugin using JQuery

  1. Pingback: BV

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s