Advertisement
GWibisono

click - popup

Oct 27th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.46 KB | None | 0 0
  1. <link rel="stylesheet" type="text/css" media="screen" href="themes/cupertino/jquery-ui-1.10.3.custom.min.css" />
  2. <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" />
  3. <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" />
  4. <style>
  5. .tes
  6. {
  7.     width:300px;
  8.     margin:20px 200px;
  9. }
  10. .head2{
  11.     margin:0;
  12.     padding:0 30px 5px;
  13.     color:white;
  14. }
  15.    
  16. .hide {
  17.      display:none;
  18.     position:absolute;
  19.     top:30px;
  20.     background:#5c9ccc;
  21.     padding:1px;
  22.     z-index:200;
  23.     width:600px;
  24.     margin:10px auto;
  25. }
  26. .hide2 {
  27.    z-index:201;
  28.     padding:10px 0px 0 0px;
  29. }
  30.  
  31. .hide3 {
  32.     display:none;
  33.     position:fixed;
  34.     top:0;
  35.     left:0;
  36.     z-index:100;
  37.     opacity:0.5;
  38.     filter:alpha(opacity=80);
  39.     /* For IE8 and earlier */
  40.     background:gray;
  41. }
  42. li.dua {
  43.     margin:30px 20px;
  44. }
  45. .one {
  46.      
  47.     margin:auto;
  48.     padding:10px 30px;
  49.     background:white;
  50. }
  51. .two{
  52.     vertical-align: top;
  53.     padding: 11px 25px 0;
  54.     width: 120px;
  55.     float: left;
  56.     height: 50px;
  57. }
  58.  
  59. .two div{
  60. vertical-align:top;
  61. padding: 0  ;
  62. min-width:30px;
  63. float:left;
  64. }
  65.  
  66. .three{
  67.     text-align:right;
  68.     padding:0px 50px 10px 0;
  69.     width:40px;
  70.     float:right;
  71.     height:50px;
  72. }
  73. .four{
  74. background:#dfeffc;
  75. padding: 5px 6px 0;
  76. margin:0 0 1px 0;
  77.  
  78. }
  79.  
  80. .clear{
  81. clear:both;
  82. }
  83. .block {
  84.     float:left;
  85.     padding-bottom:15px;
  86.     width:150px;
  87. }
  88. .block div{
  89.      float:left;
  90. }
  91. .block .txt{
  92.  
  93. }
  94. </style>
  95. <script src="js/jquery.min.js" type="text/javascript"></script>
  96. <script src="js/jquery-ui-custom.min.js" type="text/javascript"></script>
  97.  
  98. <script>
  99. jQuery("#gs_item").bind("click", function()
  100. {
  101.     show("#gs_item");
  102. });
  103.  
  104. var active="#gs_item";
  105. console.log('tessting');
  106. function show(t) {
  107.     active=t;
  108.  
  109.     var $this = $(t);
  110.     var shide = $(".hide3");
  111.     h=window.innerHeight; w=$(window).width()
  112.     if(h<600) h=640;
  113.     if(w<1000) w=1024;
  114.     shide.width(w);
  115.     shide.height(h);
  116.     shide.show();
  117.    
  118.  
  119.     var shide = $(".hide");
  120.     shide.css('display', 'none');
  121.  
  122.     pos = $this.position();
  123.  
  124.     top = pos.top;
  125.  
  126.     offset = $this.offset();
  127.  
  128.     divThis = $this.parent();
  129.     n1 = divThis.height()-10;
  130.  
  131.  
  132.     posLeft=Math.ceil(  offset.left+20) ;//($(window).width() - /2
  133.     shide.css('top', offset.top + n1);
  134.     shide.css('left', posLeft );
  135.     w=$(window).width() - posLeft -120;
  136.     shide.css('width',w);
  137.     shide.show();
  138.    
  139. }
  140.  
  141. function hideAll() {
  142.     var shide = $(".hide3");
  143.     shide.css('display', 'none');
  144.     var shide = $(".hide");
  145.     shide.css('display', 'none');
  146. }
  147.  
  148. function cariData() {
  149.     var i = 0;
  150.     var ar = new Array();
  151.     $(".cat").each(function () {
  152.  
  153.         if ($(this).is(':checked')) {
  154.  
  155.             ar[i] = $(this).val();
  156.             i++;
  157.         }
  158.     });
  159.     s = ar.join(', ');
  160.     $(active).val(s);
  161. }
  162.  
  163.  
  164.  
  165. function checkAll() {
  166.     if ($(".checkAll").is(':checked')) {
  167.         $(".cat").prop("checked", true);
  168.     } else {
  169.         $(".cat").prop("checked", false);
  170.     }
  171.     $(".checkNone").prop("checked", false);
  172.     cariData();
  173. }
  174.  
  175. function checkNone() {
  176.  
  177.     $(".checkAll").prop("checked", false);
  178.     $(".cat").prop("checked", false);
  179.     $(".checkNone").prop("checked", false);
  180.     cariData();
  181. }
  182.  
  183. $(function () {
  184.     $(".cat").change(function () {
  185.         cariData();
  186.         $(".checkAll").prop("checked", false);
  187.     });
  188.     $(".button").button();
  189. });
  190. </script>
  191. <div class='hide'>
  192.     <div class='hide2'>
  193.     <h2 class='head2'>Category</h2>
  194.     <div class='four'>
  195.         <div class='two'>
  196.              <div> <input type=checkbox onclick='checkAll();' class='checkAll' /> </div>
  197.             <div>Select All</div>
  198.         </div>
  199.         <div class='two'>
  200.             <div> <input type=checkbox onclick='checkNone();' class='checkNone' /> </div>
  201.             <div >Select None</div>
  202.         </div>
  203.         <div class='three'>
  204.             <a href="#"onclick='hideAll();'  class='button' >apply</a>
  205.         </div>
  206.         <br class='clear' />
  207.     </div>
  208.         <div class='one'>
  209. <?php
  210. $aBuah=array(
  211. 'Apel',
  212. 'Jeruk',
  213. 'Rambutan',
  214. 'Durian',
  215. 'Anggur'
  216.  
  217. );
  218. for($i=1;$i<count($aBuah);$i++)
  219. {?>    
  220.             <div class='block'>
  221.                 <div><input type=checkbox value='<?=$aBuah[$i];?>' class='cat' /></div>
  222.                 <div class='txt'><?=$aBuah[$i];?></div>
  223.             </div>
  224. <?php
  225. }
  226. ?>            
  227.             <div style='clear:both'></div>
  228.         </div>
  229.     </div>
  230. </div><div class='hide3' onclick='hideAll()'></div>
  231.  
  232. <div class='tes'>
  233. <input id='gs_item' placeholder='click here' name='gs_item' onclick='show("#gs_item");return false;' />
  234. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement