English 中文(简体)
拼接移动中的折叠内装物
原标题:Collapsible Content in jquery mobile

在有列表视图的页面顶部,我有一个简单的可折叠的内容元素。 html工作正常 。

我的问题是,如果一个用户打开折叠区块, 我希望当用户离开或回到页面时自动关闭。 折叠区块总是和用户离开时一样。 我不知道如何关闭它。 我搜索了几天, 但找不到确切的情景。 我发现的大多数解决方案都与动态加载页面有关, 但这些解决方案对我来说太先进了, 难以理解 。

我知道这也许很简单, 但我是新来的, 无法移动。 我不知道该如何将代码与 html 元素绑在一起, 或者放在哪里, 所以请用婴儿步来配合我。

有人知道怎么做吗?

最佳回答

嗨,在我的jqm网站应用程序 我关闭了程序 折叠块像这样:

$ (. ui- colleptible.) 触发器( 崩溃) ;

您应该像这样绑定页面活动 :

$( #your_page_id ).bind( pageshow , function(){

            $ (. ui- colleptible.) 触发器( 崩溃) ;

       });  

例如,您可以尝试这个 " "http://jsfiddle.net/CjwtD/" rel="noreferrer" 标题="jsFiddle" >jsFiddle

问题回答

与 jQM 1. 4 一起工作 :

$( #yourdivId ).collapsible( collapse );

人们可以做到这一点:

$(document).on("pageshow", "#yourpageId", function () {
  $( #yourdivId ).collapsible( collapse );
})




相关问题
jQuery Mobile - Dynamically creating form elements

I m creating a web-database driven offline web-app targeted at iOS devices. I m trying to use jQuery Mobile, but I have a problem in creating the various forms. The form options are taken from a ...

How to use jQuery Mobile to create iPhone Web Apps?

I have been assigned to create a web app for the iPhone, and I was supposed to try jQuery Mobile for developing as it supports many platforms. Is PHP a requirement for creating iPhone web apps? What ...

Change button text jquery mobile

I m using the new jquery mobile 1.0 alpha 1 release to build a mobile app and I need to be able to toggle the text of a button. Toggling the text works fine, but as soon as you perform the text ...

Full width horizontal buttons with jquery mobile?

In Jquery mobile, I can have grouped horizontal buttons, but they the group does not take 100% width. I tried adding a class that sets width:100% but that did not work. How can I do it? Thank you! ...

Difference between jQTouch and jQuery mobile

What is the difference between jQTouch & jQuery Mobile Framework ? Are they related (other than being both based on jQuery) ? Do they have the same goal ? Edit: jQTouch is now jQT

Long Press in JavaScript?

Is it possible to implement "long press" in JavaScript (or jQuery)? How? (source: androinica.com) HTML <a href="" title="">Long press</a> JavaScript $("a").mouseup(function(){ // ...

jQuery and mobile browser compatibility?

I want to build a relatively simple version of my site for mobile phones, but I will definitely need JavaScript and jQuery for many functions. Googling didn t help to find an answer. How is ...

热门标签