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


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

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 Àº ÀÌ°ÍÀ» Çϴµ¥ °¡Àå ½¬¿î ¹æ¹ýÀ» ¾Ë·Á ÁÝ´Ï´Ù.

ÃßõÃßõ : 505 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
2,891
ÀÔ·Â Çʵ忡¼­ ƯÁ¤´Ü¾î(¿¹:#err)°¡ Æ÷ÇԵǾúÀ» ¶§ ½Ç½Ã°£ °¨Áö ¹× °æ°íâ ¶ç¿ì±â
2,890
µ¥ÀÌÅͺ£À̽º ÃÖÀûÈ­¿Í Äõ¸® È¿À²¼ºÀ» ³ôÀÌ °Ë»ö ¼º´ÉÀ» °³¼±ÇÏ´Â ¹æ¹ý
2,889
°£´ÜÇÑ °Ô½ÃÆÇ ¸¸µé±â
2,888
PHPÀÇ php.ini ÆÄÀÏ¿¡¼­ ¼³Á¤ÇÒ ¼ö ÀÖ´Â ÁÖ¿ä Ç׸ñµéÀ» Ä«Å×°í¸®º°·Î Á¤¸®
2,887
À¯Æ©ºê µ¿¿µ»óÀÇ ½æ³×ÀÏ À̹ÌÁö¸¦ üũÇÏ¿© À¯È¿ÇÑ ¿µ»óÀ̾ƴҶ§ ¿¬°áµÈ üũ¹Ú½º¸¦ ÀÚµ¿À¸·Î üũ
2,886
À̹ÌÁö URLÀÌ À¯È¿ÇÏÁö ¾ÊÀ» ¶§, ÇØ´ç À̹ÌÁö¿Í ¿¬°áµÈ üũ¹Ú½º¸¦ ÀÚµ¿À¸·Î üũ
2,885
HTTPS·Î Á¢¼ÓÇÑ »ç¿ëÀÚ¸¦ °­Á¦·Î HTTP·Î ¸®µð·º¼Ç ÇÏ·Á¸é
2,884
PHP¿¡¼­ MP3 ÆÄÀÏÀ» Á÷Á¢ ÀÐ°í ½ºÆ®¸®¹Ö Çϱâ
2,883
ÇöÀç ÆäÀÌÁö°¡ location.reload()¿¡ ÀÇÇØ »õ·Î°íħµÇ¾ú´ÂÁö
2,882
ÅؽºÆ® ÆÄÀÏÀ» Àаí, °¢ ÁÙÀÇ ³¡¿¡¼­ 6±ÛÀÚ¸¦ »èÁ¦ÇÑ ÈÄ, °á°ú¸¦ »õ·Î¿î ÆÄÀÏ¿¡ ÀúÀåÇÕ´Ï´Ù.
2,881
cURLÀ» »ç¿ëÇÏ¿© ¸®´ÙÀÌ·ºÆ®¸¦ µû¶ó°¡ ÃÖÁ¾ URL °¡Á®¿À±â
2,880
[PHP] $_SERVER ȯ°æº¯¼ö
2,879
10Áø¼ö <-> 16Áø¼ö º¯È¯±â PHP¼Ò½º
2,878
ÅؽºÆ®¿¡ Á÷Á¢ ±×¶óµ¥ÀÌ¼Ç »ö»óÀ» Àû¿ëÇÏ·Á¸é?
2,877
CSS¸¦ »ç¿ëÇÏ¿© ¿ä¼ÒÀÇ ³»¿ë¹°¿¡ µû¶ó width¸¦ Á¶Á¤ÇÏ´Â ¹æ¹ý
2,876
À¥¼­¹ö ip È®ÀÎ
2,875
À¥È£½ºÆÃÀÇ Àý´ë°æ·Î¸¦ È®ÀÎ
2,874
input ÀÔ·Â ÇÊµå ¾ÕµÚ °ø¹é ½Ç½Ã°£ Á¦°Å
2,873
Placeholder Æ÷Ä¿½º½Ã °¨Ãß±â
2,872
MySQL Áߺ¹µÈ µ¥ÀÌÅ͸¦ »èÁ¦
2,871
MySQL Áߺ¹ µ¥ÀÌÅÍ È®ÀÎ
2,870
sessionStorage.getItem ¿Í sessionStorage.setItem
2,869
Á¦ÀÌÄõ¸® ·£´ýÀ¸·Î ¹è°æ»ö º¯°æ
2,868
preg match¿¡ °üÇÑ Á¤±Ô½Ä
2,867
Stream an audio file with MediaPlayer ¿Àµð¿À ÆÄÀÏ ½ºÆ®¸®¹Ö Çϱâ
2,866
Audio Streaming PHP Code
2,865
PHP $ SERVER ȯ°æ º¯¼ö Á¤¸®
2,864
Vimeo (ºñ¸Þ¿À) API ¸¦ »ç¿ëÇÏ¿© Ç÷¹À̾î ÄÁÆ®·ÑÇϱâ
2,863
iframe »ç¿ë½Ã ÇÏ´Ü¿¡ ¹ß»ýÇÏ´Â °ø¹é Á¦°Å¹æ¹ý
2,862
¾ÆÀÌÇÁ·¹ÀÓ(iframe) Àüüȭ¸é °¡´ÉÇÏ°Ô Çϱâ
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.