ȸ¿ø°¡ÀԡžÆÀ̵ð/ºñ¹øã±â
ȨÀ¸·Î


jQuery Mobile ½ÃÀÛÇϽô ºÐµéÀ» À§ÇÑ 10°¡Áö ÆÁ°ú ¿¹Á¦µé...
9³â Àü

10 handy jQuery mobile tips and snippets to get you started


1. A full basic page

°¡Àå ±âº»ÀÌ µÇ´Â ÆäÀÌÁöÀÇ full mark-up ÀÔ´Ï´Ù. °£´ÜÇÑ single page¸¦ Ç¥ÇöÇϽ÷Á¸é ¿©±â ÀÖ´Â Äڵ尡 °¡Àå ±âº»ÀÌ µÇ´Â °Ì´Ï´Ù.

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
</head>
<body>
<div data-role="page" id="home">
<div data-role="header">
<h1>Header</h1>
</div>
<div data-role="content">
<p>Content goes here</p>
</div>
<div data-role="footer">
<h4>Footer</h4>
</div>
</div>
</body>
</html>

2. Where to add traditional jQuery calls

óÀ½ ½ÃÀÛÇÒ ¶§ ¸ð¹ÙÀÏ Ç÷¯±×ÀÎÀÌ trigger µÇ±â Àü¿¡ ¹º°¡ ÇØ¾ß µÇ´Â°Ô ÀÖ´Ù´Â °É ¾Ë°Ô µÆ½À´Ï´Ù. ±âº» jQuery ¸¦ »ç¿ëÇÏ°í ½Í¾ú°Åµç¿ä.
±×·¯¸é ¸ð¹ÙÀÏ plug-inÀ» ÂüÁ¶Çϱâ ÀÌÀü¿¡ jQuery callÀ» ³Ö¾îÁÖ½Ã¸é µË´Ï´Ù. ±×·¯¸é jQuery Mobile º¸´Ù jQuery command°¡ ¸ÕÀú ½ÇÇàÀÌ µÇ°ÚÁÒ. ¾Æ·¡¿¡ ±× ÆÐÅÏÀÌ ÀÖ½À´Ï´Ù.


<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script> $(document).ready(function() { // Your jQuery commands go here before the mobile reference }); </script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>

3. Disable AJAX navigation for all links at once

AJAX navigationÀº ¾ÆÁÖ ¸ÚÁöÁÒ. ±×·±µ¥ °¡²û ÀÌ ±â´ÉÀ» disable ½Ãų ÇÊ¿ä°¡ ÀÖÀ» ¶§°¡ ÀÖ¾î¿ä. ÀÌ·² ¶§ AJAX navigationÀ» »ç¿ëÇÏÁö ¸»µµ·Ï ÇÒ ¼ö °¡ ÀÖ½À´Ï´Ù.
Çì´õºÎºÐ¿¡¼­ jQuery mobile library¸¦ reference ÇÑ ÈÄ ¿¡ ¾Æ·¡ ÄÚµùÀ» Ãß°¡ÇØ º¸¼¼¿ä.
jQuery mobile library°¡ ¸ÕÀú load µÇ ÀÖ¾î¾ß ÇÕ´Ï´Ù. ±×·¯´Ï±î ¹Ýµå½Ã ±× ´ÙÀ½¿¡ ³Ö¾î¾ß ÇÕ´Ï´Ù.
<script> $(document).ready(function() { // disable ajax nav $.mobile.ajaxLinksEnabled = false; }); </script>

¡¡

4. Stop some key items from being truncated

jQuery Mobile libraryÀÇ ±â´É Áß Çϳª´Â ³»¿ëÀÌ ±æ¸é ¾Ë¾Æ¼­ UI element¿¡ ¸ÂÃç¼­ À߶óÁشٴ °Ì´Ï´Ù.
±×·±µ¥ µÎ°¡Áö °æ¿ì¿¡ ÀÌ·± ±â´ÉÀÌ Á» ºÒÆíÇØ Áú ¶§°¡ ÀÖ´õ¶ó±¸¿ä. ù¹ø°´Â full text¸¦ º¸°í ½ÍÀ» ¶§±¸¿ä. µÎ¹ø°´Â footer text ÀÔ´Ï´Ù. ÀÌ·±°Íµé¿¡¼­ ³»¿ëÀÌ Àß·Á¼­ "..."·Î Ç¥½ÃµÇ¸é Á» ±×·¸ÁÒ.
ÀÌ µÎ°¡Áö °æ¿ì¿¡´Â µðÆúÆ®·Î ¾Æ·¡¿Í °°Àº CSS¸¦ ¿À¹ö¶óÀ̵å ÇØ ÁÖ¼¼¿ä.

For list items:
body .ui-li .ui-li-desc {
white-space: normal;
}

For footer content:
body .ui-footer .ui-title {
white-space: normal;
}


5. Use media queries to target devices
ÀÛ¾÷À» Çϸ鼭 ±¸ÇöÇØ¾ß ÇÒ °Í Áß¿¡ Çϳª°¡ °¢ device º°·Î ¾î¶»°Ô µû·Îµû·Î CSS¸¦ ±¸ÇöÇÏ´À³Ä ÀÔ´Ï´Ù. ¿¹¸¦ µé¾î ¾ÆÀÌÆе忡¼­´Â 2°³ÀÇ Ä÷³ ·¹À̾ƿôÀ» ¾²°í ½Í°í ½º¸¶Æ®Æù¿¡¼­´Â ÇÑ°³ÀÇ Ä÷³ ·¹À̾ƿôÀ» ½á¾ß ÇÒ ¶§°¡ ÀÖÀݾƿä.
ÀÌ°ÍÀ» ±¸ÇöÇÏ·Á¸é media queries ¸¦ »ç¿ëÇÏ½Ã¸é µË´Ï´Ù.
ÀÌ ¹Ìµð¾îÄõ¸®¸¦ ÀÌ¿ëÇؼ­ °¢ ½ºÅ©¸° »çÀÌÁî º° CSS¸¦ ±¸ÇöÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.

¾Æ·¡ ¸µÅ©¸¦ º¸½Ã¸é µÎ°³ÀÇ ¾ÆÁÖ ÈǸ¢ÇÑ ¾ÆƼŬÀÌ ÀÖ½À´Ï´Ù. ÂüÁ¶Çϼ¼¿ä.

CSS Media Queries and Using Available Space CSS-Tricks;
Hardboiled CSS3 Media Queries Stuff and Nonsense.


6. Target platforms with jQuery

ƯÁ¤ µð¹ÙÀ̽º¿¡ ƯÁ¤ CSS¸¦ ½ÇÇàÇØ¾ß ÇÒ ¶§°¡ ÀÖÁÒ. ±×¸®°í ¿ÀÁ÷ jQuery ¸¸ »ç¿ëÇØ¾ß µÉ 떄°¡ ÀÖ½À´Ï´Ù. ¿©±â some code from Snipplr¿¡¼­ °¡Á®¿Â Äڵ尡 Àִµ¥¿ä. jQuery ·Î À¯Àú µð¹ÙÀ̽º¿¡ ¸Â°Ô jQueryÀÇ segment portionµéÀ» ½±°Ô »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ÇÏ´Â ¹æ¹ýÀÔ´Ï´Ù.

var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod|ipad|android)/);
if(agentID.indexOf("iphone")>=0){
alert("iphone");
}
if(agentID.indexOf("ipod")>=0){
alert("ipod");
}
if(agentID.indexOf("ipad")>=0){
alert("ipad");
}
if(agentID.indexOf("android")>=0){
alert("android");
}



7. Use full paths for the targets of form action attributes

One quirk of the library seems to be its difficulty in finding target pages to post forms to¡¦ that is, unless you use the full path from the root of the website.

For example, I¡¯ve found that this form tag never finds its target:
<form action=" form-handler.php " method="get" >

Whereas a full path like this works as expected:
<form action="/current-directory/form-handler.php" method="get" >

Also, be sure that the results from the form handler produce a full, valid jQuery mobile page, as shown in tip #1.

8. Create pop-up dialogs
jQuery Mobile libraryÀÇ ÁÁÀº ±â´É Áß Çϳª´Â built-in pop-upÇÏ°í dialog box ±â´ÉÀÌÁÒ. Á¤¸» °£´ÜÇÏ°í ½±°Ô ÀÌ¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ±âº»ÀûÀ¸·Î data-rel="dialog" ¸¦ ºÙ¿©ÁÖ¸é µË´Ï´Ù.
µÎ°¡Áö¸¸ ±â¾ïÇϼ¼¿ä. ù¹ø°·Î target page´Â ¹Ýµå½Ã full-blown jQuery mobile page¶ó¾ß ÇÕ´Ï´Ù.

µÎ¹ø°´Â Á¦´ë·Î ÀÛµ¿À» Çϵµ·Ï ÇÏ·Á¸éÀº full separate page¶ó¾ß ÇÑ´Ù´Â °Ì´Ï´Ù.

<a href="#pop.html" data-rel="dialog">Pop up!</a>


9. A ¡°Cancel¡± + ¡°Save¡± button combo

µÎ°³ÀÇ ¹öÆ°À» ³ª¶õÈ÷ ³Ö¾î¾ß ÇÒ ¶§°¡ ÀÖÁÒ? ÀÌ·² °æ¿ì´Â fieldset tag¸¦ ¾²½Ã¸é Æí¸®ÇÕ´Ï´Ù.
±×¸®°í µÎ°³ÀÇ ¹öÆ°À» ´Ù¸¥ themeÀ¸·Î Ç¥ÇöÇÒ ¼öµµ ÀÖ½À´Ï´Ù.
ÀÌ ÄÚµå´Â ¿©±â¿¡ Àִ°̴ϴÙ. ÀÚÁÖ ÀÌ¿ëÇϱ⠶§¹®¿¡ Àú°°Àº °æ¿ì´Â µû·Î º¸°üÇØ µ×´Ù°¡ ¾²°í ÀÖ½À´Ï´Ù.

<fieldset>
<div><button type="submit" data-theme="c">Cancel</button></div>
<div><button type="submit" data-theme="b">Submit</button></div>
</fieldset>

¡¡

10. Create a column structure on your own

´Ù¾çÇÑ µð¹ÙÀ̽º¸¦ À§ÇÑ single page structure¿¡ ´ëÇØ À§¿¡¼­ ¹Ìµð¾î Äõ¸®¿Í columns¸¦ »ç¿ëÇÏ´Â ¹æ¹ýÀ» À§¿¡¼­ ¾Ë·Á µå·ÈÁÒ.

´ÙÇàÈ÷ À¥ °³¹ßÀÚµéÀÌ Ä÷³µéÀ» ¾î¶»°Ô »ç¿ëÇÏ´ÂÁö¿¡ ´ëÇØ ÀÌÀü¿¡ ¸¹ÀÌ ¸¸µé¾î ³ù¾ú½À´Ï´Ù. ÀÌ ±â´ÉµéÀ» ¹Ìµð¾îÄõ¸®¿Í °°ÀÌ ¼¯¾î¾²¸é ÆíÇÏ°ÚÁÒ. ¿ì¸®´Â ´Ù¾çÇÑ ½ºÅ©¸°»çÀÌÁî¿¡ ¸Â°Ô ´Ù¾çÇÑ structure¸¦ ½±°Ô setup ÇÒ ¼ö ÀÖ½À´Ï´Ù.

Position Is Everything Àº ÀÌ°ÍÀ» Çϴµ¥ °¡Àå ½¬¿î ¹æ¹ýÀ» ¾Ë·Á ÁÝ´Ï´Ù.

ÃßõÃßõ : 438 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
2,885
input ÀÔ·Â ÇÊµå ¾ÕµÚ °ø¹é ½Ç½Ã°£ Á¦°Å
2,884
Placeholder Æ÷Ä¿½º½Ã °¨Ãß±â
2,883
MySQL Áߺ¹µÈ µ¥ÀÌÅ͸¦ »èÁ¦
2,882
MySQL Áߺ¹ µ¥ÀÌÅÍ È®ÀÎ
2,881
sessionStorage.getItem ¿Í sessionStorage.setItem
2,880
Á¦ÀÌÄõ¸® ·£´ýÀ¸·Î ¹è°æ»ö º¯°æ
2,879
preg match¿¡ °üÇÑ Á¤±Ô½Ä
2,878
Stream an audio file with MediaPlayer ¿Àµð¿À ÆÄÀÏ ½ºÆ®¸®¹Ö Çϱâ
2,877
Audio Streaming PHP Code
2,876
PHP $ SERVER ȯ°æ º¯¼ö Á¤¸®
2,875
Vimeo (ºñ¸Þ¿À) API ¸¦ »ç¿ëÇÏ¿© Ç÷¹À̾î ÄÁÆ®·ÑÇϱâ
2,874
iframe »ç¿ë½Ã ÇÏ´Ü¿¡ ¹ß»ýÇÏ´Â °ø¹é Á¦°Å¹æ¹ý
2,873
¾ÆÀÌÇÁ·¹ÀÓ(iframe) Àüüȭ¸é °¡´ÉÇÏ°Ô Çϱâ
2,872
ºÎÆ®½ºÆ®·¦(bootstrapk)¿¡¼­ »ç¿ëÇÏ´Â class¸í Á¤¸®
2,871
ºÎÆ®½ºÆ®·¦ CSS
2,870
Å©·Ò¿¡¼­ ¸¶Áø Á¶Àý
2,869
PHP ÇöÀç ÆäÀÌÁöÀÇ µµ¸ÞÀθíÀ̳ª urlµîÀÇ Á¤º¸ ¾Ë¾Æ¿À±â
2,868
PHP preg match all()
2,867
PHP ·Î À¥ÆäÀÌÁö ±Ü¾î¿À±â ¸ðµç ¹æ¹ý ÃÑÁ¤¸®!
2,866
[PHP] ¿ø°ÝÁö ÆÄÀÏ ÁÖ¼Ò ³ëÃâ ¾ÈÇÏ°í curl·Î ´Ù¿î·Îµå ¹Þ±â
2,865
PHP ÇÔ¼ö Á¤¸®
2,864
¾ÆÀÌÇÁ·¹ÀÓ(iframe) ºñÀ² À¯ÁöÇϸ鼭 Å©±â Á¶ÀýÇÏ´Â ¹æ¹ý
2,863
PHP ¹è¿­¿¡¼­ ¹«ÀÛÀ§·Î Çϳª »Ì¾ÆÁÖ´Â array rand() ÇÔ¼ö
2,862
PHP Á¤±Ô½Ä Á¤¸®
2,861
PHP Á¤±Ô½ÄÀ» È°¿ëÇÑ ÅÂ±× ¹× ƯÁ¤ ¹®ÀÚ¿­ Á¦°Å ¹× ÃßÃâ ¹æ¹ý
2,860
php Å©·Ñ¸µ ¶Ç´Â ÆÄ½Ì ÇÔ¼ö, Á¤±Ô½Ä ¸ðÀ½
2,859
Á¦ÀÌÄõ¸® ±âº» ¸í·É¾î
2,858
À¥ÆäÀÌÁö °¡·Î ¸ðµå¼¼·Î ¸ðµå ÀνÄÇϱâ
2,857
¸ð¹ÙÀÏ À¥ È­¸é °­Á¦ ȸÀü(°¡·Î¸ðµå °íÁ¤)
2,856
[HTML5]¿¡¼­ frameset ´ëü ¹æ¹ý°ú iframe ¼Ó¼º
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.