Popups common to all pages in jQuery Mobile site

前端 未结 3 1157
鱼传尺愫
鱼传尺愫 2020-12-30 17:23

I am trying to make a site using jQuery Mobile. It consists of many pages in HTML files, some of which have only one page, and some of which have several pages (using their

相关标签:
3条回答
  • 2020-12-30 18:24

    May be very late to the party, but may be useful for someone coming across.

    Now you can use Global Popups if you are using latest JQM (I am using JQM 1.4.2). You just need to declare the popup directly under body div, out side all data-role pages.

    Better go through this JQM documentation

    0 讨论(0)
  • 2020-12-30 18:26

    I've seen your request on jQuery Mobile github, and posted a solution that I'm using on my web applications. Check http://ghita.org/jquery/dynamic-mobile-popup it's a small plugin that allows you to have dynamic popups, it let you focus on the content of the popup and the events.

    Include the plugin (has 1.8kb), and then call:

    $.dynamicPopup({content: 'This is the dynamic content of the popup.'});
    

    content - can be a string or a jQuery html object.

    Check https://github.com/serbanghita/jQM-dynamic-popup for the full list of options, some of which are inherited from jQuery's mobile popup() function.

    This problem was a show stopper for me because I have dynamic webpages and I don't care of manually injecting HTML content for the popup() to be active. Hope you find it helpful.

    0 讨论(0)
  • 2020-12-30 18:26

    you would have to try and set it up like the jqm loader, which also resides outside of the div.page (otherwise you would have one loader per page inside the dom), so i think the right approach would be to not include the popup within a page, but outside the div.page.

    as jqm will only pull in div.pages and nothing before/after you should be able to include a generic popover on every page and only have it in the dom once. not sure this is working though outside div.page.

    0 讨论(0)
提交回复
热议问题