AMP-html 如何防止用户单击输入时关闭灯箱

标签 amp-html

我有一个 amp-lightbox 和一个表格。

 <amp-lightbox id="search-word"
                  layout="nodisplay">
        <div class="lightbox"
             on="tap:search-word.close"
             role="button"
             tabindex="0">
            
            <form id="search-word" role="search" action="https://localanagrammer.com/" target="_top">
                <div class="input-group">
                    <input type="text" id="searchWord" class="form-control" placeholder="enter scrabble word" data-ng-model="keyword" autocomplete="off" autofocus>
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="button" data-ng-click="doSearch(keyword)">
                            <span class="fa fa-search" aria-hidden="true"></span>
                        </button>
                    </span>
                </div>
            </form>
        </div>
    </amp-lightbox>

当我尝试单击文本输入时,灯箱正在关闭。

问题是:防止关闭的正确方法是什么?

最佳答案

我通过在内部元素中放置一个带有打开 Action 的水龙头来解决这个问题。这里类似的情况是(这是渲染 AMP html 的 React 代码):

        <amp-lightbox
            id="mylightbox"
            on="tap:mylightbox.close"
            class="dark-lightbox-background"
            layout="nodisplay">
            <div 
                class="container"
                on="tap:mylightbox.open">

                 <!-- content placed here -->

            </div>
        </amp-lightbox>

关于AMP-html 如何防止用户单击输入时关闭灯箱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39769690/

相关文章:

html - AMP : <amp-ad> not showing adense ads, 但字段为空

html - 创建自定义模板 WordPress AMP 后 Amp 不再有效

amp-html - amp-img错误: Layout not supported for: container

javascript - 在 AMP HTML 中提交时打开另一个表单

amp-html - 页面如何告诉浏览器存在 AMP HTML 版本?

google-analytics - 滚动的 AMP 分析事件

wordpress - 实现 AMP 后减少 AdSense 访问量/展示次数

seo - 应使用哪种 URL 结构来显示 AMP HTML 与普通 HTML

nginx - Nginx 上 Drupal 的 AMP 参数错误

cors - 如何在 PHP 中为 amp-form 输出正确的标题?