如何在甜蜜警报2中使用window.screen.width

问题描述

这是我的JavaScript代码

    var modals = [];


modals.push({
    title: 'Welcome to Lumi FansPage !',text: 'This website requires desktop web resolution to experience its features',});


modals.push({
    title: 'Checking your screen resolutions',text: 'Please wait',timer: 2500,onopen: function () {
        swal.showLoading()
    }
}).then(function () {

});

function showLoading() {
    if ($(window).width() < 1080) {
        alert('Sorry,but your screen resolution cant feel all the features,please use the Desktop Version!' +
            ' Your resolution is ' +
            window.screen.width * window.devicePixelRatio + "x" + window.screen.height * window.devicePixelRatio);
    } else {
        alert('Congratulations,you can experience all of its features Now! ' + ' Your resolution is ' + window.screen
            .width *
            window.devicePixelRatio + "x" +
            window.screen.height *
            window.devicePixelRatio);
    }
};


swal.queue(modals);

我想在检查屏幕分辨率后用window.screen.width显示屏幕分辨率,然后显示警报,但是在编写该代码后什么都没发生,那么如何在用此代码检查分辨率后显示警报?

modals.push({
    title: 'Checking your screen resolutions',onopen: function () {
        swal.showLoading()
    }
}).then(function () {

})

请帮助我

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...