first global commit
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#niceTitle p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #fff;
|
||||
font: 12px "微软雅黑",verdana,arial,sans-serif;
|
||||
}
|
||||
#niceTitle p em {
|
||||
display: block;
|
||||
margin-top: 3px;
|
||||
color: #f60;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
}
|
||||
#niceTitle .r1,#niceTitle .r2,#niceTitle .r3,#niceTitle .r4{
|
||||
background-color: #000;
|
||||
display: block;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
font-size: 1px;
|
||||
}
|
||||
#niceTitle .r2,#niceTitle .r3,#niceTitle .r4{
|
||||
border-width: 0 1px;
|
||||
border-left: 1px solid #000;
|
||||
border-right: 1px solid #000;
|
||||
}
|
||||
#niceTitle .r1{
|
||||
margin: 0 6px;
|
||||
}
|
||||
#niceTitle .r2{
|
||||
margin: 0 3px;
|
||||
}
|
||||
#niceTitle .r3{
|
||||
margin: 0 2px;
|
||||
}
|
||||
#niceTitle .r4{
|
||||
margin: 0 1px;
|
||||
height: 2px;
|
||||
}
|
||||
#niceTitle #niceTitle-ie{
|
||||
background: #000;
|
||||
border-left: 1px solid #000;
|
||||
border-right: 1px solid #000;
|
||||
padding: 0 5px;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.6 KiB |
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="css/jQuery.niceTitle.css" />
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="js/jQuery.niceTitle.js"></script>
|
||||
<title>jQuery.niceTitle design by lee(IT北瓜) www.imleeo.com</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
font: 14px "微软雅黑",verdana,arial,sans-serif;
|
||||
}
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
.info {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$("a").niceTitle();//要排除一些例外的元素,例如可以用a:not([class='nono'])来排除calss为"nono"的a元素
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="niceTitleDemo">
|
||||
<a href="http://www.imleeo.com" title="jQuery niceTitle plugin design by leeo www.imleeo.com">jQuery niceTitle plugin</a><br /><br /><br />
|
||||
<a href="http://www.imleeo.com" title="This is my blog's logo.">
|
||||
<img src="http://imleeo.com/jquery-example/images/logo.jpg" />
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
Use:<br />
|
||||
$(document).ready(function(){$("a").niceTitle();});<br />
|
||||
<a href="http://www.imleeo.com" title="For more information, please visit my blog.">www.imleeo.com</a><br />
|
||||
Download:<a href="http://plugins.jquery.com/project/niceTitle" title="Download from jQuery.com">jQuery niceTitle plugin</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* jQuery niceTitle plugin
|
||||
* Version 1.00 (1-SEP-2009)
|
||||
* @author leeo(IT北瓜)
|
||||
* @requires jQuery v1.2.6 or later
|
||||
*
|
||||
* Examples at: http://imleeo.com/jquery-example/jQuery.niceTitle.html
|
||||
* Copyright (c) 2009-2010 IT北瓜www.imleeo.com
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
|
||||
*History:
|
||||
*Version 1.00 (1-SEP-2009) The first release
|
||||
*Version 1.10 (7-SEP-2009) Fixed the bug in IE when change parameter "bgColor"(add code: line: 68,69)
|
||||
*/
|
||||
;(function($) {
|
||||
$.fn.niceTitle = function(options){
|
||||
var opts = $.extend({}, $.fn.niceTitle.defaults, options);
|
||||
var _self = this;
|
||||
this.initialize = function(_opts){
|
||||
var htmlStr = "";
|
||||
if(jQuery.browser.msie){//如果是IE浏览器,则通过css来产生圆角效果
|
||||
htmlStr = '<div id="niceTitle">' +
|
||||
'<span>' +
|
||||
'<span class="r1"></span>' +
|
||||
'<span class="r2"></span>' +
|
||||
'<span class="r3"></span>' +
|
||||
'<span class="r4"></span>' +
|
||||
'</span>' +
|
||||
'<div id="niceTitle-ie"><p><em></em></p></div>' +
|
||||
'<span>' +
|
||||
'<span class="r4"></span>' +
|
||||
'<span class="r3"></span>' +
|
||||
'<span class="r2"></span>' +
|
||||
'<span class="r1"></span>' +
|
||||
'</span>' +
|
||||
'</div>';
|
||||
}else{
|
||||
htmlStr = '<div id="niceTitle"><p><em></em></p></div>';
|
||||
}
|
||||
$(_self).mouseover(function(e){
|
||||
this.tmpTitle = this.title;//等价于$(this).attr("title");
|
||||
this.tmpHref = this.href;//等价于$(this).attr("href");
|
||||
var _length = _opts.urlSize;
|
||||
this.tmpHref = (this.tmpHref.length > _length ? this.tmpHref.toString().substring(0,_length) + "..." : this.tmpHref);
|
||||
this.title = "";//等价于$(this).attr("title", "");
|
||||
$(htmlStr).appendTo("body").find("p").prepend(this.tmpTitle + "<br />").css({"color": _opts.titleColor}).find("em").text(this.tmpHref).css({"color": _opts.urlColor});
|
||||
var obj = $('#niceTitle')
|
||||
obj.css({
|
||||
"position":"absolute",
|
||||
"text-align":"left",
|
||||
"padding":"5px",
|
||||
"opacity": _opts.opacity,
|
||||
"top": (e.pageY + _opts.y) + "px",
|
||||
"left": (e.pageX + _opts.x) + "px",
|
||||
"z-index": _opts.zIndex,
|
||||
"max-width": _opts.maxWidth + "px",
|
||||
"width": "auto !important",
|
||||
"width": _opts.maxWidth + "px",
|
||||
"min-height": _opts.minHeight + "px",
|
||||
"-moz-border-radius": _opts.radius + "px",
|
||||
"-webkit-border-radius": _opts.radius + "px"
|
||||
});
|
||||
if(!jQuery.browser.msie){//如果不是IE浏览器
|
||||
obj.css({"background": _opts.bgColor});
|
||||
}else{//Version 1.10修正IE下改变背景颜色
|
||||
$('#niceTitle span').css({"background-color": _opts.bgColor, "border-color": _opts.bgColor});
|
||||
$('#niceTitle-ie').css({"background": _opts.bgColor, "border-color": _opts.bgColor});
|
||||
}
|
||||
obj.show('fast');
|
||||
}).mouseout(function(){
|
||||
this.title = this.tmpTitle;
|
||||
$('#niceTitle').remove();
|
||||
}).mousemove(function(e){
|
||||
$('#niceTitle').css({
|
||||
"top": (e.pageY + _opts.y) + "px",
|
||||
"left": (e.pageX + _opts.x) + "px"
|
||||
});
|
||||
});
|
||||
return _self;
|
||||
};
|
||||
this.initialize(opts);
|
||||
};
|
||||
$.fn.niceTitle.defaults = {
|
||||
x: 10,
|
||||
y: 20,
|
||||
urlSize: 30,
|
||||
bgColor: "#000",
|
||||
titleColor: "#FFF",
|
||||
urlColor: "#F60",
|
||||
zIndex: 999,
|
||||
maxWidth: 250,
|
||||
minHeight: 30,
|
||||
opacity: 0.8,
|
||||
radius: 8
|
||||
};
|
||||
})(jQuery);
|
||||
+19
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user