ÁíÒ»ÖÖ¸ñʽ»¯ÄÚÈݵıã½Ý·½Ê½ÊÇ£¬Ö»ÏÔʾһ²¿·ÖÄÚÈÝ£¬ÎªÓû§Ìṩһ¸ö¸ÅÊöÒÔ¼°ÔĶÁ¸ü¶àÄÚÈݵÄÑ¡Ïî¡£ÒòΪ´ó²¿·ÖÒƶ¯É豸µÄÆÁÄ»¶¼½ÏС£¬±£³ÖÒ³Ã泤¶ÈÏà¶Ô½Ï¶Ì²¢ÇÒÖ»ÏÔʾ¶óÒªÄÚÈÝ£¬ÕâºÜÖØÒª¡£ÕÛµþÄÚÈݿ飬ÊÇ´¦ÀíÕâÖÖ¹¦ÄܵÄÒ»¸ö·Ç³£°ôµÄ·½Ê½£¨£©¡£jQuery Mobile ¿ò¼ÜΪ collapsible ÄÚÈÝÌṩһ¸ö data-role£¬ÈôʹÓÃÇ¡µ±£¬Ëü¿ÉÒÔ½« header ÔªËؼ°¹ØÁªµÄÄÚÈÝת»»ÎªÒ»¸öÕÛµþ¿é¡£
Çåµ¥ 5. ʹÓÿÉÕÛµþÄÚÈÝÇøÓò<div data-role="collapsible"> <h2>My header</h2> <p>The full content would normally be longer than this, which is why we would want to hide it by default and allow the user to choose whether they wanted to read it by viewing the title. Therefore the title plays an important role when creating collapsible content blocks.</p> </div>
ĬÈÏÇé¿öÏ£¬¿é½«Ò³Ã¼Îı¾ÏÔʾΪһ¸ö´ø + ͼ±êµÄ°´Å¥¡£µã»÷Ëüʱ£¬½«ÏÔʾÍêÕûµÄÄÚÈÝ£¬²¢ÇÒ + ͼ±ê½«±ä³ÉÒ»¸ö - ͼ±ê£¬±íʾ°´Å¥¿ÉÒÔ±»Ôٴεã»÷ÒԹرÕÍêÕûµÄÄÚÈÝ£¬²¢»Øµ½Ä¬Èϵݴť״̬¡£
´´½¨¼òµ¥µÄÁбíÁбíÊÇÔÚÒƶ¯ÍøÕ¾ÉÏÄÜ¿´µ½µÄÒ»¸ö³£ÓÃÔªËØ¡£ÀûÓà jQuery Mobile£¬Äú¿ÉÒÔ´´½¨¶àÖÖ²»Í¬µÄÁбí¸ñʽ£¬Èç»ù±¾Á´½ÓÁÐ±í¡¢Ç¶Ì×ÁÐ±í¡¢±àºÅÁÐ±í¡¢²ð·Ö°´Å¥ÁÐ±í¡¢´ø·Ö¸ô·ûµÄÁÐ±í¡¢´øͼ±êµÄÁÐ±í¡¢ËõÂÔͼ»ò¼ÆÊýÅÝÅÝ£¬ÒÔ¼°°üÀ¨ËÑË÷ɸѡÆ÷À¸µÄÁÐ±í¡£³£ÓõÄÁбíÀàÐÍÊÇ»ù±¾Á´½ÓÁÐ±í¡£Òª´´½¨Ò»¸ö»ù±¾Á´½ÓÁÐ±í£¬ÄúÖ»ÐèÒª´´½¨Ò»¸ö±ê×¼µÄ HTML ÎÞÐòÁÐ±í£¬Ìí¼ÓÒ»¸ö data-role ÊôÐÔ£¬²¢ÎªËü·ÖÅäÒ»¸öÖµ listview£¨£©¡£
Çåµ¥ 6. ʹÓà jQuery Mobile ¿ò¼Ü´´½¨»ù±¾Á´½ÓÁбí<ul data-role="listview"> <li><a href="#">List item 1</a></li> <li><a href="#">List item 2</a></li> </ul>
Òª´´½¨Ò»¸ö±àºÅÁÐ±í£¬Äú¿ÉÒÔʹÓÃÓëÇåµ¥ 6 ÏàͬµÄ´úÂ룬ֻÐ轫 ul ÐÞ¸ÄΪ ol£¬ÒÔ½«Ëüת»»ÎªÒ»¸öÓÐÐòÁÐ±í¡£
ÔöÇ¿ÁбíÔÚÄúÃ÷°×´´½¨»ù±¾ÁбíÓжà¼òµ¥ºó£¬Äú¿ÉÄܾͻáÏëÒª¸ü¶àÑ¡Ïî¡£¶ÔÁбíÌṩ¸ü¶à¹¦ÄܵÄÒ»¸öÑ¡Ïî³ÆΪ²ð·Ö°´Å¥ÁÐ±í¡£²ð·Ö°´Å¥ÁбíʹÄúÄܹ»ÔÚͬһ¸öÁбíÏîÖÐÌṩÁ½¸ö¿Éµ¥»÷µÄÑ¡Ïî¡£¸Ã¹¦ÄܶÔÁбíÏîºÜÓÐÓ㬾ٸöÀý×Ó£¬ÁбíÏî°üº¬ÓйظÃÌض¨ÏîµÄÌض¨ÏêϸÐÅÏ¢µÄÒ»¸öÁ´½Ó£¬µ«¿ÉÄÜ»¹ÐèÒª°üº¬Óë¸ÃÏîÓйصÄÆäËû²Ù×÷£¬ÀýÈçÓÃÓÚ¹ºÂò¸ÃÏî»ò½«Ëü·ÖÏíµ½Éç½»ÍøÂçÉϵÄÒ»¸ö°´Å¥¡£´´½¨Ò»¸ö²ð·Ö°´Å¥ÁбíºÜ¼òµ¥£ºÔÚʹÓà listview data-role µÄÒ»¸öÁбíÏîÖÐÌí¼ÓÁ½¸ö±Ë´ËÏàÁڵĶ¨Î»µã±ê¼Ç£¨£©¡£
Çåµ¥ 7. ʹÓà jQuery Mobile ¿ò¼Ü´´½¨²ð·Ö°´Å¥Áбí<ul data-role="listview" data-split-icon="gear"> <li> <a href="item-detail.html"> <h3>Item title</h3> <p>Item overview</p> </a> <a href="item-purchase.html" data-rel="dialog">Purchase item</a> </li> <li> <a href="item-detail.html"> <h3>Item title</h3> <p>Item overview</p> </a> <a href="item-purchase.html" data-rel="dialog">Purchase item</a> </li> </ul>
Çåµ¥ 7 ÖеIJð·Ö°´Å¥ÁбíËùÌṩµÄÁбíÏî°üÀ¨Ò»¸ö±êÌâºÍÒ»¸ö¸ÅÊö£¬Óû§¿ÉÒÔµ¥»÷Ëü²é¿´ÓйظÃÏîµÄ¸ü¶àÏêϸÐÅÏ¢¡£¸ÃÁбíÏ°üÀ¨Ò»¸öÓÃ×÷ÔÚ¶Ô»°¿òÖйºÂò¸ÃÁбíÏîµÄÒ»¸ö³¬Á´½ÓµÄͼ±ê¡£ÄúÒ²¿ÉÒÔʹÓà data-split-icon ÊôÐÔ£¬ÐÞ¸ÄÏÔʾÔÚÁбíÏîÓÒ²àµÄ²ð·Ö°´Å¥µÄĬÈÏͼ±ê¡£
ÁíÒ»¸öÓÐÓõĻù±¾ÁбíÔöÇ¿ÊÇÁбí·Ö¸ô·û¡£Áбí·Ö¸ô·ûÌṩһÖÖ¶ÔÁбíÏî½øÐзÖÀàµÄ·½Ê½¡£ÀýÈ磬Äú¿ÉÒÔÓÃ×Öĸ±ê¼ÇÄúµÄÁбíÏ²¢Ê¹ÓÃÁбí·Ö¸ô·û°´×Öĸ±íÉϵÄÿ¸ö×ÖĸÀ´·Ö¸ôËüÃÇ£¬»òÕßÄú¿ÉÄÜÓÐÒ»×éÓëÒôÀÖÏà¹ØµÄÁбíÏÄú¿ÉÒÔÓÃÁбí·Ö¸ô·û½«ËüÃǶÔÓ¦²»Í¬ÒôÀÖÁ÷ÅɽøÐзÖÀà¡£ ÏÔʾÁËÀûÓÃÁбí·Ö¸ôÆ÷ÔöÇ¿µÄÒ»¸ö¼òµ¥ÁбíʾÀý¡£
Çåµ¥ 8. ½«Áбí·Ö¸ô·ûÌí¼Óµ½ listview<ul data-role="listview"> <li data-role="list-divider">Alternative</li> <li><a href="#">Nirvana</a></li> <li data-role="list-divider">Rock and Roll</li> <li><a href="#">Jimi Hendrix</a></li> <li><a href="#">Led Zeppelin</a></li> </ul>
ʹÓà data-role ÊôÐÔÖµ list-divider£¬Ê¹ÕâЩÁбíÏîÓëÆäËûÁбíÏî¾ßÓв»Í¬µÄÊÓ¾õÑùʽ¡£
ÄúÒ²¿ÉÒÔͨ¹ýʹÓÃͼ±ê¡¢ËõÂÔͼºÍ¼ÆÊýÅÝÅÝÀ´´´½¨²»Í¬µÄÊÓ¾õÑùʽ¡£Äú¿ÉÒÔͨ¹ýʹÓà ul-li-count À࣬½«¼ÆÊýÅÝÅÝÌí¼Óµ½Ò»¸öÁбíÏ£©¡£
Çåµ¥ 9. ½«¼ÆÊýÅÝÅÝÌí¼Óµ½ jQuery Mobile ÁбíÏî<ul data-role="listview"> <li> <a href="inbox.html">Inbox <span>12</span> </a> </li> </ul>
¾ÍÏñÄú½«Ò»¸öͼƬÌí¼Óµ½ HTML Ò³ÃæÖÐÒ»Ñù£¬ÄúÒ²¿ÉÒÔÌí¼ÓÒ»¸öËõÂÔͼ¡£Ö»ÐèÒª½«Ò»¸ö¶¨Î»µãÔªËØÌí¼Óµ½ÁбíÏÌí¼ÓÒ»¸öÓÃ×÷ËõÂÔͼµÄͼƬ£¬È»ºóÌí¼ÓÄúÏ£ÍûÔÚËüÅÔ±ßÏÔʾµÄ¸±±¾¡£jQuery Mobile ¾Í»á´¦ÀíÊ£ÏµĹ¤×÷£¨¼û £©¡£
Çåµ¥ 10. ½«ËõÂÔͼÌí¼Óµ½ jQuery Mobile ÁбíÏî<ul data-role="listview"> <li> <a href="zeppelin.html#thank-you"> <img src="images/album-cover.jpg" /> <h3>Led Zeppelin</h3> <p>Thank You</p> </a> </li> <li> <a href="zeppelin.html#ten-years"> <img src="images/album-cover.jpg" /> <h3>Led Zeppelin</h3> <p>Ten Years</p> </a> </li> </ul>
Äú¿ÉÒÔʹÓÃÓëÌí¼ÓËõÂÔͼһÑùµÄ·½·¨À´Ìí¼Óͼ±ê£»Î©Ò»µÄÇø±ðÊÇÄúҪʹÓà ui-li-icon À࣬Èç Ëùʾ¡£
Çåµ¥ 11. ½«Í¼±êÌí¼Óµ½ jQuery Mobile ÁбíÏî<ul data-role="listview"> <li> <a href="zeppelin.html"> <img src="images/album-cover.jpg" /> Led Zeppelin Album </a> </li> <li> <a href="hendrix.html"> <img src="images/album-cover.jpg" /> Jimi Hendrix Album </a> </li> </ul>
ul-li-icon ÀàÏÞÖÆͼƬµÄ´óС£¬×î´ó¿í¶ÈºÍ¸ß¶ÈΪ 40px£¬Ëü»¹Äܹ»½«Í¼Æ¬·ÅÔÚÁбíÏîÖеÄÊʵ±Î»Öá£
ËÑË÷ɸѡ
¡¡