【问题标题】:Show a preloader image while append a huge image in the html body在 html 正文中附加一个巨大的图像时显示一个预加载器图像
【发布时间】:2012-04-26 04:26:10
【问题描述】:

在 html 正文中附加一个巨大的图像之前,我需要显示一个预加载器图像。在我的脚本中,只有在完成加载后,鼠标悬停事件才会显示带有图像的工具提示。图像需要很长时间才能完成。同时我想在页面上显示一些东西。

this.screenshotPreview = function(){    
xOffset = 10;
yOffset = 30;
$('a.screenshot').hover(function(e){
    this.t = this.title;
    this.title = '';    
    var c = (this.t != '') ? '<br/>' + this.t : '';
    $('body').append('<p id="screenshot"><img src="images/image.png" alt="Url preview" />'+ c +'</p>');
    $('#screenshot')
    .css('top',(e.pageY - xOffset) + 'px')
    .css('left',(e.pageX + yOffset) + 'px')
    .fadeIn('fast');                        
},
function(){
   this.title = this.t; 
   $('#screenshot').remove();
}); 
$('a.screenshot').mousemove(function(e){
    $('#screenshot')
    .css('top',(e.pageY - xOffset) + 'px')
    .css('left',(e.pageX + yOffset) + 'px');
});         
};

// starting the script on page load
$(document).ready(function(){
screenshotPreview();
});

谢谢。

【问题讨论】:

    标签: jquery load append preloader


    【解决方案1】:

    请在此 div #screenshot 上设置预加载器背景图片,

    当这个div附加时,BG会在显示IMG大图之前显示

    【讨论】:

    • 所以你必须点击 Reputation score .. :)
    猜你喜欢
    • 2012-11-07
    • 2010-12-06
    • 2014-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-20
    • 1970-01-01
    相关资源
    最近更新 更多