Advertisement
RUSSEL86

Checkbox Custom Style

Jan 31st, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. Html code
  2. -------------
  3. <div class="newslater_label fix">
  4. <input name="_mc4wp_action[]" type="checkbox" value="subscribe" checked><span>General Subscription</span>
  5. </div>
  6. CSS code
  7. -----------
  8. .newslater_label.fix input[type="checkbox"] {
  9. opacity: 0;
  10. }
  11. .activecheck_bill {
  12. position: relative;
  13. }
  14. .cusize_check_billing {
  15. display: inline-block;
  16. width: 19px;
  17. height: 19px;
  18. background: #fff;
  19. border: 1px solid #c2c2c2;
  20. position: relative;
  21. float: left;
  22. margin-right: 10px;
  23. }
  24. activecheck_bill:before {
  25. content: "";
  26. position: absolute;
  27. top: 0px;
  28. left: 0;
  29. background: url(http://www.powerbanners.co.uk/wp-content/themes/power-banner/img/tick_checkbill.png) no-repeat scroll 3px 4px;
  30. width: 19px;
  31. height: 19px;
  32. }
  33.  
  34.  
  35. Jquery code
  36. ----------------------------
  37. jQuery('.newslater_label input').wrap('<div class="cusize_check_billing fix"></div>');
  38. jQuery('.newslater_label input').click(function(){
  39. if(jQuery(this).is(':checked')){
  40. jQuery(this).parent('.cusize_check_billing').addClass('activecheck_bill').find('.newslater_label input').removeClass('activecheck_bill');
  41. }
  42. else{
  43. jQuery(this).parent('.cusize_check_billing').removeClass('activecheck_bill');
  44. }
  45. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement