Guest User

Untitled

a guest
Jan 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>
  4. </title>
  5. <link rel="stylesheet" href="css/cece.css">
  6. <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
  7. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  8. </head>
  9. <body>
  10. <form action="#" method="post">
  11. <div>
  12. <div class="col-xs-4 col-sm-3 col-md-2 text-center">
  13. <label class="image-checkbox">
  14. <img class="img-responsive" src="https://dummyimage.com/282x188/000/fff" />
  15. <input type="checkbox" name="artikel1" value="" />
  16. <i class="fa fa-check hidden"></i>
  17. </label>
  18. </div>
  19. </div>
  20. <div>
  21. <div class="col-xs-4 col-sm-3 col-md-2 text-center">
  22. <label class="image-checkbox">
  23. <img class="img-responsive" src="https://dummyimage.com/282x188/000/fff" />
  24. <input type="checkbox" name="artikel2" value="" />
  25. <i class="fa fa-check hidden"></i>
  26. </label>
  27. </div>
  28. </div>
  29. <div>
  30. <div class="col-xs-4 col-sm-3 col-md-2 text-center">
  31. <img class="img-responsive" src="https://dummyimage.com/282x188/000/fff" />
  32. </div>
  33. </div>
  34. <div>
  35. <div class="col-xs-4 col-sm-3 col-md-2 text-center">
  36. <img class="img-responsive" src="https://dummyimage.com/282x188/000/fff" />
  37. </div>
  38. </div>
  39. <input type="submit" class="btn btn-success" value="Submit Button">
  40. </form>
  41. </body>
  42. <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
  43. <script src="js/checkboxes.js?t=<?php time(); ?>"></script>
  44. </html>
  45.  
  46. .nopad {
  47. padding-left: 0 !important;
  48. padding-right: 0 !important;
  49. }
  50.  
  51. .image-checkbox {
  52. position: relative;
  53. cursor: pointer;
  54. box-sizing: border-box;
  55. -moz-box-sizing: border-box;
  56. -webkit-box-sizing: border-box;
  57. border: 4px solid transparent;
  58. margin-bottom: 0;
  59. outline: 0;
  60. display: block;
  61. }
  62. .image-checkbox input[type="checkbox"] {
  63. display: none;
  64. }
  65.  
  66. .image-checkbox-checked {
  67. border-color: #4783B0;
  68. }
  69. .image-checkbox .fa {
  70. position: absolute;
  71. color: #4A79A3;
  72. background-color: #fff;
  73. padding: 10px;
  74. top: 0;
  75. right: 0;
  76. }
  77. .image-checkbox-checked .fa {
  78. display: block !important;
  79. }
  80.  
  81. jQuery(function ($) {
  82. // init the state from the input
  83. $(".image-checkbox").each(function () {
  84. if ($(this).find('input[type="checkbox"]').first().attr("checked")) {
  85. $(this).addClass('image-checkbox-checked');
  86. }
  87. else {
  88. $(this).removeClass('image-checkbox-checked');
  89. }
  90. });
  91.  
  92. // sync the state to the input
  93. $(".image-checkbox").on("click", function (e) {
  94. if ($(this).hasClass('image-checkbox-checked')) {
  95. $(this).removeClass('image-checkbox-checked');
  96. $(this).find('input[type="checkbox"]').first().removeAttr("checked");
  97. }
  98. else {
  99. $(this).addClass('image-checkbox-checked');
  100. $(this).find('input[type="checkbox"]').first().attr("checked", "checked");
  101. }
  102.  
  103. e.preventDefault();
  104. });
  105. });
Add Comment
Please, Sign In to add comment