Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7851693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:14:35+00:00 2026-06-02T19:14:35+00:00

I have a <ul> with data-role=listview attribute. For the <li> elements, i would like

  • 0

I have a <ul> with data-role=”listview” attribute. For the <li> elements, i would like to have a <div>, within the <li>, that covers the main contents in the <li>, and when a person swipes to the right, the <div> animates sliding right, revealing the contents underneath div.

My problem is that when I add the div to the <li> element, i cant get the <div> to cover the <li> element. Even if i set a style of style: height=100%, the div seems only to take up about 2/3 of the <li> elements space.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:14:36+00:00Added an answer on June 2, 2026 at 7:14 pm

    You can add your DIV element to a list-item like so:

    HTML —

        <ul data-role="listview">
            <li data-icon="grid"><a href="#">This is normal content.</a><div class="cover-div">Swipe to Uncover</div></li>
            <li data-icon="grid"><a href="#">This is normal content.</a><div class="cover-div">Swipe to Uncover</div></li>
            <li data-icon="grid"><a href="#">This is normal content.</a><div class="cover-div">Swipe to Uncover</div></li>
            <li data-icon="grid"><a href="#">This is normal content.</a><div class="cover-div">Swipe to Uncover</div></li>
            <li data-icon="grid"><a href="#">This is normal content.</a><div class="cover-div">Swipe to Uncover</div></li>
        </ul>
    

    This creates the following output after jQuery Mobile initializes the list-view:

    <li data-icon="grid" data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-iconpos="right" data-theme="c" class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-btn-up-c">
        <div class="ui-btn-inner ui-li">
            <div class="ui-btn-text">
                <a href="#" class="ui-link-inherit">This is normal content.</a>
                <div class="cover-div">Swipe to Uncover</div>
            </div>
            <span class="ui-icon ui-icon-grid ui-icon-shadow">&nbsp;</span>
        </div>
    </li>
    

    Then you can add positioning and background-styling to the element:

    CSS —

    .cover-div {
        position   : absolute;
        top        : 0;
        left       : 0;
        width      : 100%;
        height     : 100%;
        z-index    : 2;
        background : #000;
        background : rgba(0, 0, 0, 0.7);
        color      : #fff;
    }​
    

    And finally you can detect the swipe events on the “cover” DIVs and animate the element off-screen:

    JS —

    //when a page is initialized by jQuery Mobile, we'll do our own initialization
    $(document).delegate('[data-role="page"]', 'pageinit', function () {
    
        //find all the `.cover-div` elements on this page and bind to swipe left/right events for the elements
        $(this).find('.cover-div').bind('swipeleft swiperight', function (event) {
    
            //if the user swiped to the left then animate the DIV to the left
            if (event.type == 'swipeleft') {
                $(this).stop().animate({ left : '-100%' }, 250);
    
            //otherwise animate the DIV to the right
            } else {
                $(this).stop().animate({ left : '100%' }, 250);
            }
        });
    });
    ​
    

    Here is a demo: http://jsfiddle.net/pmqDf/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an empty list at the start like this. <ul id=list data-role=listview data-inset=true>
I have data in a python dictionary that I'd like to store in a
In jQueryMobile, I have written a data-role=listview component and I want to filter the
I have the following view <ul data-role=listview data-inset=true> <!-- ko with: model.Item_selected --> <li
I have a simple list with a search. <ul data-role=listview data-inset=false data-filter=true data-iconpos=right> My
I have a simple work role in azure that does some data processing on
I have a JQM page with two data-role=listview . They both share the same
How can I convert my 6x &nbsp; to CSS I have the <ul data-role=listview
I use ListView with link like this: <ul data-dividertheme=d data-theme=c data-role=listview style=width:100%;margin: 0px >
I have one worker role that throws data into around 10 queues that need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.