简体   繁体   English

使用Jqtouch的iPhone的模式警报框

[英]Modal Alert box for iphone using Jqtouch

I am developing a simple iPhone web application. 我正在开发一个简单的iPhone Web应用程序。 I am stuck with creating an alert box using jqtouch. 我坚持使用jqtouch创建警报框。 Does anybody how to create a sample modal alert box on the iPhone? 是否有人在iPhone上创建示例模式警报框? I don't want to use the existing JavaScript alert due the title bar problem. 由于标题栏问题,我不想使用现有的JavaScript警报。

Are sample code or references available? 是否提供示例代码或参考?

You want to use the floaty extension. 您要使用floaty扩展名。 See a live example with your iPhone or Safari in DEV iPhone mode here: link text 在此处以DEV iPhone模式查看iPhone或Safari的实时示例: 链接文本

The code to include on that page is listed on that page, view source. 该页面上列出的代码在该页面上列出,查看源代码。 The extension is the JS file and these functions call it. 扩展名是JS文件,这些函数调用它。

script src="../../extensions/jqt.floaty.js" type="application/x-javascript" charset="utf-8" 脚本src =“ ../../ extensions / jqt.floaty.js” type =“ application / x-javascript” charset =“ utf-8”

        $(function(){

            $('#togglefloaty').click(function(){
                $('.floaty').toggleFloaty();
                $(this).removeClass('active');
                return false;
            });

            $('#hidefloaty').click(function(){
                $('.floaty').hideFloaty();
                $(this).removeClass('active');
                return false;
            });

            $('div#jqt .floaty').makeFloaty({
                spacing: 20,
                time: '1s'
            });

        });

            <ul class="individual">
                <li><a href="#" id="hidefloaty">Hide Floaty</a></li>
                <li><a href="#" id="togglefloaty">Toggle Floaty</a></li>
            </ul>

In jQTouch demo you will find a demo named ext_floaty . 在jQTouch演示中,您将找到一个名为ext_floaty的演示。 You can use the floating window as alert. 您可以将浮动窗口用作警报。

Here is some relevant discussion 这是一些相关的讨论

Well, I know this is almost a year old, but I was struggling with it and here are a couple of things I came across. 好吧,我知道这已经快一年了,但是我一直在努力,这是我遇到的一些事情。

The floaty div needs to be outside of any of the jqt pages, meaning you can't really have a special floaty WITHIN a jqt page div. float div必须在任何jqt页面之外,这意味着在jqt页面div内您真的不能有一个特殊的floaty。

For creating my floaty (a div with the id "notify_window"), starting hidden, I did this: 为了创建我的浮动对象(ID为“ notify_window”的div),开始隐藏,我这样做:

$('#notify_window').makeFloaty({spacing: 120, time: '1s'}).hide().toggleFloaty();

I create the floaty, hidden and then I toggle it "off", so when I call the floaty I do this: 我创建了一个浮动对象,将其隐藏,然后将其切换为“关闭”,因此,当我调用浮动对象时,请执行以下操作:

$("#notify_window").show().toggleFloaty();

It's actually pretty straighforward. 实际上很简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM