You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
936 B
JavaScript
38 lines
936 B
JavaScript
6 years ago
|
/*
|
||
|
友好tips
|
||
|
*/
|
||
|
//插件主题
|
||
|
$.fn.extend({
|
||
|
showTitle: function() {
|
||
|
$("#showTitleBox").remove();//清除原有的层
|
||
|
$('<div id="showTitleBox"></div>').appendTo('body');
|
||
|
var d = $("#showTitleBox");
|
||
|
this.bind({
|
||
|
mouseover: function() {
|
||
|
// if ($("#showTitleBox")) {
|
||
|
// $('<div id="showTitleBox"></div>').appendTo('body');
|
||
|
// } else {
|
||
|
// d = $("#showTitleBox");
|
||
|
// }
|
||
|
var of = $(this).offset();
|
||
|
var title = $(this).attr("title");
|
||
|
//定义位置
|
||
|
d.css({
|
||
|
position:'absolute',
|
||
|
top: of.top + $(this).height() + "px",
|
||
|
left: $(this).width() / 2 + of.left + "px",
|
||
|
border:'#666666 solid 1px',
|
||
|
'background-color':'#FFFFFF',
|
||
|
'color':'#336600',
|
||
|
padding:'5px'
|
||
|
}).text($(this).attr("title"));
|
||
|
//显示
|
||
|
d.animate({opacity: "show"}, "slow");
|
||
|
},
|
||
|
mouseout: function() {
|
||
|
//鼠标一走隐藏
|
||
|
d.animate({opacity: "hide"}, "fast");
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|