如何手动使加载gif的颜色框出现? [英] How to manually make the colorbox loading gif appear?

查看:85
本文介绍了如何手动使加载gif的颜色框出现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已配置了colorbox,并且在加载窗口时会显示加载gif,但是当我从窗口中调用页面方法时如何显示它呢?

I have colorbox configured and the loading gif appears when the window loads but how can I get it to appear when I am calling a page method from whithin the window?

我正在用jScript调用该方法,并且效果很好,但是加载gif不会出现,因此直到出现用户提示消息时,它好像什么都没有发生。

I am calling the method in jScript and it works just fine but the loading gif does not appear so it makes it feel like nothing it happening until my user prompt message appears.

反正我可以在代码中调用加载的gif吗?

Is there anyway I can call the loading gif in my code?

我的jScript非常简单:

My jScript is pretty straight forward:

// handler for submit button calling page method
    $addHandler($get('SendEmailPageMethod'), 'click', EmailPageMethod);
});

function EmailPageMethod() {
    var name = $get('name').value;
    var email = $get('email').value;
    var message = $get('message').value;

    PageMethods.SendEmail(name, email, message, SuccessCallback, ErrorCallback);
}

function SuccessCallback(resultString) {
    $('#innerForm').addClass('hidden');
    $('div.successMsg').removeClass('hidden');
    //alert(String(resultString));
}

function ErrorCallback(resultString) {
    alert(String(resultString));
    parent.jQuery.colorbox.close();
}

此jScript位于打开颜色框窗口的父页面上:

This jScript is on the parent page that opens the colorbox window:

                // handles colorbox for contact form
                $('#contact-form').colorbox({ maxWidth: '75%',
                    close: '',
                    // removes selected class from contact menu item on close
                    onClosed: function () {
                        $('#contact-form').removeClass('selected');
                    }
                });

这是我打开颜色框表单并提交时jScript控制台所说的内容。

This is what the jScript console says when I open the colorbox form and submit it.

推荐答案

只需在文档中查询相关元素并更改其显示类型:

Just query your document for the relevant elements and change their display type:

$('#cboxLoadingOverlay, #cboxLoadingGraphic').show();

这篇关于如何手动使加载gif的颜色框出现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆