;(function() { $.fn.lCenter = function() { //return this.each(function(){ return this.css('left', (($(window).width() - this.width()) / 2 + ((this.css('position')=='fixed') ? 0 : $(window).scrollLeft()) )+'px'); //}); } $.fn.tCenter = function() { //return this.each(function(){ return this.css('top', (($(window).height() - this.height()) / 2 + ((this.css('position')=='fixed') ? 0 : $(window).scrollTop()) )+'px'); //}); } $(function() { var $fwin, $mask, $loading; //floatwin var $fwtrg = $("a.disp_fwin"); $("body") .append($('
')) .append($('
')) ; $mask = $(".com_mask").hide(); $loading = $(".com_loading").hide(); //loadcss $("").appendTo($('head')); fn_fwshow = function(event, u) { if(event) event.preventDefault(); if($fwin && $fwin.jquery) return; if(!u) var u = $(this).attr('href'); //tip //fn_tipshow(); //mask $mask.width($(document).width()).height($(document).height()).show() .dblclick(function() {$fwin.trigger('close')}) .attr("title","双击背景即可关闭浮窗"); //loading $loading.tCenter().lCenter().animate({opacity:'show'}, 'default'); //fwin $fwin = $("
").appendTo($('body'));//.attr('dScrollTop', $(document).scrollTop()); $("
X
").appendTo($fwin); $fwin.hide(); //close $fwin.bind('close', function() { $fwin.animate({opacity:'hide'}, "default", function() {$(this).remove()}); $mask.hide().attr("title","").unbind('dblclick'); $('.com_closetip').remove(); $fwin = null; $loading.hide(); }) //inner iframe $ifrm = $(''); $ifrm.appendTo($fwin).load(function(rst) { $loading.animate({opacity:'hide'}, 'fast'); $fwin.lCenter().tCenter().animate({opacity:'show'}, 'slow'); if($.browser.msie) { $ifrm.contents().find(".container").width("501px").height("450px").css("overflow", "hidden").find('#seccode').focus(); } //Drag //$('#com_fw_banner').drag($fwin); //closebtn $('.com_fw_closebtn').click(function(event) { event.preventDefault(); this.blur(); $fwin.trigger('close'); }); });//end of iframe load //cancel the click return false; };//endof fn_fwshow $fwtrg.click(fn_fwshow); var bindScroll = function(fn) { $(document).scroll(fn); $(window).scroll(fn); $('body').scroll(fn); } bindScroll(function(event) { $loading.tCenter().lCenter(); if($fwin) { $fwin.tCenter().lCenter(); //$(document).scrollTop($fwin.attr('dScrollTop')); } }); }); })(jQuery);//