Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. <style type="text/css">
  2. .onoff input.toggle {
  3. display: none;
  4. }
  5.  
  6. .onoff input.toggle + label {
  7. display: inline-block;
  8. position: relative;
  9. box-shadow: inset 0 0 0px 1px #d5d5d5;
  10. height: 30px;
  11. width: 70px;
  12. background: #DC143C;
  13. border-radius: 30px;
  14. }
  15.  
  16. .onoff input.toggle + label:before {
  17. cursor: pointer;
  18. content: "0a0 0a0 0a0 0a0 0a0 0a0 0a0 Não";
  19. display: block;
  20. color: #FFF;
  21. height: 30px;
  22. border-radius: 30px;
  23. background: rgba(19, 191, 17, 0);
  24. transition: 0.1s ease-in-out;
  25. }
  26.  
  27. .onoff input.toggle + label:after {
  28. content: "";
  29. position: absolute;
  30. height: 30px;
  31. width: 30px;
  32. top: 0;
  33. left: 0px;
  34. border-radius: 30px;
  35. background: #fff;
  36. box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.2);
  37. transition: 0.1s ease-in-out;
  38. }
  39.  
  40. .onoff input.toggle:checked + label:before {
  41. cursor: pointer;
  42. width: 70px;
  43. content: "0a0 0a0 0a0 Sim";
  44. color: #FFF;
  45. font-family: 'Arial';
  46. background: #13bf11;
  47. }
  48. .onoff input.toggle:checked + label:after {
  49. left: 40px;
  50. box-shadow: inset 0 0 0 1px #13bf11, 0 2px 4px rgba(0, 0, 0, 0.2);
  51. }
  52. #estado{ font-size: 14px; font-weight: bold;}
  53. </style>
  54.  
  55. <table class="table table-striped">
  56. <thead>
  57. <tr>
  58. <td>Nome</td>
  59. <td>Ativo?</td>
  60. </tr>
  61. </thead>
  62. <tbody>
  63. <?php
  64. ...
  65. while($pe = mysqli_fetch_object($sql))
  66. {
  67. ?>
  68. <tr>
  69. <td><?php echo $pe->Nome; ?></td>
  70. <td>
  71. <div class="onoff">
  72. <input type="checkbox" class="toggle" id="onoff">
  73. <label for="onoff"></label>
  74. <input type="hidden" name="Avisar" id="campo1" value="0">
  75. </div>
  76. </td>
  77. <?php
  78. }
  79. ?>
  80. </tbody>
  81. </table>
  82.  
  83. <script type='text/javascript'>
  84. //<![CDATA[
  85. window.onload=function(){
  86. var onoff = document.getElementById('onoff');
  87. onoff.addEventListener('change', function() {
  88. estado = this.checked ? 'S' : 'N';
  89. var campo = document.getElementById("campo1").value = estado;
  90. $.ajax({
  91. data: {
  92. estado: this.checked,
  93. campo: campo
  94. }
  95. }).done(function(msg) {
  96. });
  97. });
  98. }//]]>
  99. ///////////////////
  100. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement