// javascript document (function($) { jquery.fn.positionfixed = function(options) { var defaults = { css: '', top: -1, bottom: -1, left: -1, right: -1 }; var o = jquery.extend(defaults, options); var isie6 = false; if ($.browser.msie && parseint($.browser.version) == 6) isie6 = true; var html = $('html'); //if (isie6 && html.css('backgroundattachment') !== 'fixed') { // html.css('backgroundattachment', 'fixed') //}; return this.each(function() { var domthis = $(this)[0]; var objthis = $(this); if (isie6) { objthis.css('position', 'absolute'); if (o.top >= 0) domthis.style.setexpression('top', 'eval((document.documentelement).scrolltop + ' + o.top + ') + "px"'); if (o.bottom >= 0) domthis.style.setexpression('bottom', 'eval((document.documentelement).scrollbottom + ' + o.bottom + ') + "px"'); if (o.left >= 0) domthis.style.setexpression('left', 'eval((document.documentelement).scrollleft + ' + o.left + ') + "px"'); if (o.right >= 0) domthis.style.setexpression('left', 'eval(document.documentelement.scrollleft+document.documentelement.clientwidth-this.offsetwidth-(parseint(this.currentstyle.marginleft,10)||0)-(parseint(this.currentstyle.marginright,10)||0) - ' + o.right + ') + "px"'); } else { objthis.css('position', 'fixed'); if (o.top >= 0) objthis.css('top', o.top); if (o.bottom >= 0) objthis.css('bottom', o.bottom); if (o.left >= 0) objthis.css('left', o.left); if (o.right >= 0) objthis.css('right', o.right); } }); }; })(jquery); $(function() { var data = []; for (var i = 0; i < data.length; i++) { var strhtml = "
"; if (data[i].url == null || data[i].url.length == 0 || data[i].url == "http://") strhtml += ""; else strhtml += ""; strhtml += "关闭"; strhtml += "
"; var item = $(strhtml); if (data[i].location == 1) item.positionfixed({ top: data[i].top, left: data[i].left }); else if (data[i].location == 2) item.positionfixed({ top: data[i].top, right: data[i].right }); else if (data[i].location == 3) item.positionfixed({ bottom: data[i].bottom, left: data[i].left }); else if (data[i].location == 4) item.positionfixed({ bottom: data[i].bottom, right: data[i].right }); else continue; $("body").append(item); } });