Interactive Rows
Lists become more powerful when we combine them with touch interaction.
If a list element contains an a
element, it will convert that row in an interactive one for touch and/or
cursor navigation. One great feature of jQuery Mobile is that the whole
row will be interactive automatically for touch no matter where the link
is placed inside the row. Meaning the user doesn’t need to tap only in the
link’s text area. She can tap on any pixel in the row.
Note
An interactive row has a different height than a read-only one. This different design is optimized for touch interaction, as the touch area needs to be large enough to avoid errors. The row text also has a larger font size. In iOS-based devices, 44 pixels is the recommended height for most common controls. Other touch devices use similar sizes.
The framework automatically adds a nice arrow at the right side of
the row giving the user a hint that the row is touchable, as seen in Figure 4-5. This icon can be changed using data-icon, as we will see in a minute.
On the same list, we can mix interactive rows with read-only rows. However, the most typical UI design is to have full-interactive or full-read-only lists.
In the following sample, shown in Figure 4-5, we can see interactive rows in action:
<!DOCTYPE html> <html> <head> <!-- Typical jQuery Mobile header goes here --> </head> <body> <div data-role="page" id="main"> <div data-role="header"> <h1>Interactive</h1> </div> <div data-role="content"> <ul data-role="listview"> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access