javascript Modal Mobile(andoid,ios)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Modal Mobile(andoid,ios)相关的知识,希望对你有一定的参考价值。

<div id="modalApp" class="splash" style="<?= (!isset($_COOKIE['modalApp'])) ? '' : 'display:none;' ?>">
    <img class="splash-img" src="" alt="">
    <div class="splash-logo">
        <img src="/bitrix/templates/.default/img/splash/logo.png" alt="">
        <span><a href="https://site.ru">test.ru</a> для <span id="deviceOs">iPhone</span></span>
    </div>
    <a class="btn-splash-highlighted" href="#">Скачать приложение</a>
    <a tabindex="0" class="btn-splash" onclick="document.getElementById('modalApp').style.display = 'none';">Пропустить</a>
</div>
<? if (!isset($_COOKIE['modalApp'])) setCookie("modalApp", 'on', time() + 3600 * 24, '/', 'site.ru'); ?>
$(function () {
    if (device.iphone()) {
        $('#deviceOs').text('iPhone');
        $('.btn-splash-highlighted').attr('href', 'https://itunes.apple.com/ru/app/test/id11');
        $('.splash-img').attr('src', '/bitrix/templates/.default/img/splash/bg-ios.webp');
    }
    if (device.android()) {
        $('#deviceOs').text('Android');
        $('.btn-splash-highlighted').attr('href', 'https://play.google.com/store/apps/details?id=ru.test.test');
        $('.splash-img').attr('src', '/bitrix/templates/.default/img/splash/bg-android.webp');
    }

    if (!device.iphone() && !device.android()) {
        $('.splash').hide();
    }
})

以上是关于javascript Modal Mobile(andoid,ios)的主要内容,如果未能解决你的问题,请参考以下文章

通过单击链接通过 JavaScript 打开 Bootstrap 4 Modal

javascript modal en javascript

18bootStap JavaScript插件

JavaScript 判断手机端访问并跳转 redirect mobile

Bootstrap之javascript插件---弹出框(模态框)Modal

9 Top JavaScript Frameworks For Mobile App Development