Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

68 lines (65 sloc) 2.505 kB
<!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>
<title></title>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/float.js" type="text/javascript"></script>
<script src="Scripts/ImageListDebug.js" type="text/javascript"></script>
</head>
<body>
<div>
<div id="msgBox" style="height: 20px">
</div>
<img src="images/fry.jpg" />
<a href="http://pic002.cnblogs.com/images/2012/429355/2012080820270130.jpg" title="Download"
download>test download for chrome</a>
</div>
<script type="text/javascript">
function showImgSaveBtn(img) {
var btn = $(img).next();
if (btn && btn.html() == "save") {
btn.show();
}
else {
var offset = $(img).offset();
var w = $(img).outerWidth(false);
var h = $(img).outerHeight(false);
$("<div/>").css({
background: "orange",
width: "40px",
height: "20px",
position: "absolute",
top: offset.top + h - 20 + "px",
left: offset.left + w + "px",
cursor: "pointer",
textAlign: "center"
}).html("save").bind("click", function () { download(img.src); }).hover(function (event) {
$(this).show();
$(img).css("border", "5px solid orange");
},
function (event) {
$(this).hide();
$(img).css("border", "");
}).insertAfter($(img));
}
}
function hideImgSaveBtn(img) {
var btn = $(img).next();
if (btn && btn.html() == "save") {
btn.hide();
}
}
function addborder(event) {
$(this).css("border", "5px solid orange");
showImgSaveBtn(this);
}
function removeborder(event) {
$(this).css("border", "");
hideImgSaveBtn(this);
}
//$("img").after($("<p/>").html("hello"));
// $("<img/>").attr("src", "images/icon_save.png").insertAfter($("img"));
$($("img").hover(addborder, removeborder));
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.