ui.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. $(function(){
  2. // gnb
  3. var w = $("nav").outerWidth();
  4. var h = $("body").height();
  5. $("#header #menu").on("click", function(){
  6. var _top = $(document).scrollTop();
  7. $("body").css("margin-top",-_top + "px").addClass("fixed");
  8. $("#contentLayer").fadeIn();
  9. $("nav").css({"right":-w + "px", "height":h+"px"}).show().animate({"right":"0"}, 500, 'swing');
  10. });
  11. $("#contentLayer, nav .close").on("click", function(){
  12. var _top = $("body").css("margin-top").replace(/[^0-9]/g,'');
  13. $("nav").animate({"right":-w+"px"}, function(){
  14. $("nav").hide();
  15. $(".dim").remove();
  16. $("nav > ul > li > a").removeClass("on");
  17. });
  18. $("#contentLayer").fadeOut();
  19. $("body").removeClass("fixed").css("margin-top","");
  20. $("html, body").scrollTop(_top);
  21. });
  22. $("nav > ul > li > a").on("click", function(){
  23. if($(this).hasClass("on")){
  24. $(this).removeClass("on");
  25. } else {
  26. $(this).parent().siblings().find("a").removeClass("on");
  27. $(this).addClass("on");
  28. }
  29. });
  30. // clause list
  31. $(".clause_chk_list li div").hide();
  32. $(".clause_chk_list li:first-child div").show();
  33. $(".clause_chk_list .detail").click(function(){
  34. $(this).parent().siblings().find("div").hide();
  35. $(this).siblings("div").show();
  36. });
  37. // input=file
  38. var fileTarget = $('.filebox .upload-hidden');
  39. fileTarget.on('change', function(){
  40. if(window.FileReader){
  41. var filename = $(this)[0].files[0].name;
  42. } else {
  43. var filename = $(this).val().split('/').pop().split('\\').pop();
  44. }
  45. $(this).siblings('.upload-name').val(filename);
  46. });
  47. // popup close
  48. $(".layer_popup .close").click(function(){
  49. $(this).parent().hide();
  50. $(".dim").remove();
  51. });
  52. // business list
  53. $(".business_list li ul").hide();
  54. $(".business_list li:first-child ul").show();
  55. $(".business_list > li > p").click(function(){
  56. $(this).parent().siblings().find("ul").hide();
  57. $(this).siblings("ul").show();
  58. });
  59. $(".success_confirm > li > p").click(function(){
  60. // alert($(this).attr("noauth"));
  61. if($(this).attr("noauth") == undefined){
  62. if(!$(this).hasClass("on")){
  63. $(this).parents(".success_confirm").find("li > p").removeClass("on");
  64. $(this).addClass("on");
  65. } else {
  66. $(this).removeClass("on");
  67. }
  68. }else{
  69. alert("먼저 이전 단계 확인바랍니다.");
  70. }
  71. });
  72. // faq
  73. $(".faq li > p").click(function(){
  74. $(this).parents(".faq").find(".a").hide();
  75. $(this).siblings(".a").show();
  76. });
  77. });
  78. // layer pop
  79. function openLayer(ele){
  80. var _this = $("."+ele + "_popup");
  81. var _thisW = _this.outerWidth() / 2;
  82. var _thisH = _this.height() / 2;
  83. _this.css('margin-left',-_thisW);
  84. _this.css('margin-top',-_thisH);
  85. _this.show();
  86. $("body").append("<div class='dim'></div>");
  87. }
  88. function closeLayer(ele){
  89. var _this = $("."+ele + "_popup");
  90. _this.hide();
  91. $(".dim").remove();
  92. }
  93. // layer pop
  94. function lockLayer(ele){
  95. var _this = $("#"+ele);
  96. _this.show();
  97. $("body").append("<div class='dim'></div>");
  98. }
  99. function unlockLayer(ele){
  100. var _this = $("#"+ele);
  101. _this.hide();
  102. $(".dim").remove();
  103. }