Jquery的弹出式菜单没有标题

编程入门 行业动态 更新时间:2024-10-25 10:29:10
本文介绍了Jquery的弹出式菜单没有标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的标题中有一个右侧按钮。点击按钮时,会弹出一个列表菜单。但是当我向下滚动页面时,标题向下滚动。但弹出式菜单始终保持在顶部。如何使标题的弹出菜单棒?以下是我的代码。

< html> < head> < title>我的页面< /标题> < meta name =viewportcontent =width = device-width,initial-scale = 1> < link rel =stylesheethref =code.jquery/mobile/1.4.5/jquery.mobile-1.4.5.css/> < script src =code.jquery/jquery-1.8.2.min.js>< / script> < script src =code.jquery/mobile/1.4.5/jquery.mobile-1.4.5.js>< / script> < style> < / style> < / head> < body> < div data-role =page> < div data-role =headerdata-position =fixed> < h1>聊天< / h1> p>

我如何使它与我的标题粘在一起?甚至滚动到结尾。感谢 更新: 我编辑了我的代码(请参阅Nisal Upendra解决方案)对于第二个屏幕截图是固定的。但是如果我先向下滚动,然后点击标题按钮。菜单在屏幕中间弹出,如下图所示:

解决方案

您需要在弹出窗口中添加 style =min-width:150px; position:fixed; right:30px; 造型。 这是一个小提琴: jsfiddle/hym405nz/1/ p>

I have a right side button in my header. When click the button, a popup list menu will display. But when I scroll down the page, header is scroll down. But the popup menu is keep stick at top. How to I make popup menu stick with header? Below is my code.

<html> <head> <title>My Page</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="code.jquery/mobile/1.4.5/jquery.mobile-1.4.5.css" /> <script src="code.jquery/jquery-1.8.2.min.js"></script> <script src="code.jquery/mobile/1.4.5/jquery.mobile-1.4.5.js"></script> <style> </style> </head> <body> <div data-role="page"> <div data-role="header" data-position="fixed"> <h1>Chats</h1> <a id="chatpageicon" href="#photopopup" data-rel="popup" data-position-to="origin" data-role="button" data-theme="b" data-icon="plus" data-form="ui-icon" data-iconpos="notext" class="ui-btn-b ui-shadow ui-corner-all ui-icon-plus ui-btn-right ui-btn-icon-notext ui-btn-up-b" ></a> <div data-role="popup" id="photopopup"> <ul data-role="listview" data-inset="true" style="min-width:150px;position:fixed;right:30px;"> <li><a href="#">List1</a></li> <li><a href="#">List2</a></li> </ul> </div> </div> <div data-role="content"> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> <p>asd</p> </div> </div> </body> </html>

Before scroll:

After scroll down, the popup menu still keep at same position:

How do I make it stick together with my header? Even scroll to the end. Thanks Updated: I edited my code (refer "Nisal Upendra" solution), the issue for second screen shot is fixed. But if I scroll down first, and click the header button. the menu is popup at middle of the screen as image as below:

解决方案

You need to add style="min-width:150px;position:fixed;right:30px;" to your popup styling. Here's a fiddle: jsfiddle/hym405nz/1/

更多推荐

Jquery的弹出式菜单没有标题

本文发布于:2023-08-06 04:46:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1310157.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出式   菜单   标题   Jquery

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!