基于jquery.js的插件
(function($){
$.fn.djkPop = init;
function init(url,imgSrc) {
wrapPop(url,imgSrc);
}
function wrapPop(url,imgSrc){
var wrapPop = "<div style='position: fixed;right: 0.3rem;bottom: 4rem;'><a style='display: block;width: 1.24rem;height: 1.24rem;' href=" + url +"><img style='width: 1.24rem;height: 1.24rem;' src="+ imgSrc +" /></a></div>";
$("body").append(wrapPop);
}
})(jQuery);
页面调用
<script type="text/javascript">
//启动
$(function () {
$("body").djkPop("悬浮链接","图片");
})
</script>