ui.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. $(function(){
  2. // gnb
  3. $("nav > ul > li > a").on("mouseenter", function(){
  4. $("header").addClass("open");
  5. });
  6. $("nav > ul > li").on("mouseenter", function(){
  7. $("nav > ul > li > a").removeClass("on");
  8. $(this).children("a").addClass("on");
  9. });
  10. $("header").on("mouseleave", function(){
  11. $("nav > ul > li > a").removeClass("on");
  12. $("header").removeClass("open");
  13. });
  14. // faq
  15. $(".faq li > p").click(function(){
  16. $(this).parents(".faq").find(".a").hide();
  17. $(this).siblings(".a").show();
  18. });
  19. // input=file
  20. var fileTarget = $('.filebox .upload-hidden');
  21. fileTarget.on('change', function(){
  22. if(window.FileReader){
  23. var filename = $(this)[0].files[0].name;
  24. } else {
  25. var filename = $(this).val().split('/').pop().split('\\').pop();
  26. }
  27. $(this).siblings('.upload-name').val(filename);
  28. });
  29. // clause list
  30. $(".clause_list li div").hide();
  31. $(".clause_list li:first-child div").show();
  32. $(".clause_list .btn_open").click(function(){
  33. $(this).parent().siblings().find("div").hide();
  34. $(this).siblings("div").show();
  35. });
  36. // select
  37. if($(".select").length > 0){
  38. $('.select').jqTransform();
  39. };
  40. // location
  41. if($(".sub_depth").length > 0){
  42. $(".location .depth1").css("cursor","pointer");
  43. $(".location .depth1").click(function(){
  44. $(this).siblings("ul").show();
  45. });
  46. $(".sub_depth a").click(function(){
  47. $(".sub_depth").hide();
  48. });
  49. }
  50. $(document).mouseup(function(e) {
  51. var container = $(".sub_depth");
  52. //var container_in = $(".search .option");
  53. if (!container.is(e.target) && container.has(e.target).length === 0){
  54. container.css("display","none");
  55. //container.find("li").removeClass("open");
  56. }
  57. });
  58. // popup close
  59. $(".layer_popup .close").click(function(){
  60. $(this).parent().hide();
  61. $(".dim").remove();
  62. });
  63. // tab
  64. if($(".tab li > a.on").siblings("ul").length > 0){
  65. $(".tab").css("height","130px");
  66. }
  67. // review rolling
  68. /*if($(".review_rolling").length > 0){
  69. var swiper = new Swiper('.review_rolling', {
  70. autoHeight : 'true',
  71. autoplay: {
  72. delay: 3500,
  73. disableOnInteraction: false,
  74. },
  75. pagination: {
  76. el: '.swiper-pagination',
  77. },
  78. });
  79. }*/
  80. });
  81. // layer pop
  82. function openLayer(ele){
  83. var _this = $("."+ele + "_popup");
  84. var _thisW = _this.width() / 2;
  85. var _thisH = _this.height() / 2;
  86. _this.css('margin-left',-_thisW);
  87. _this.css('margin-top',-_thisH);
  88. _this.show();
  89. $("body").append("<div class='dim'></div>");
  90. }
  91. function closeLayer(ele){
  92. var _this = $("."+ele + "_popup");
  93. _this.hide();
  94. $(".dim").remove();
  95. }
  96. // layer pop
  97. function lockLayer(ele){
  98. var _this = $("#"+ele);
  99. _this.show();
  100. $("body").append("<div class='dim'></div>");
  101. }
  102. function unlockLayer(ele){
  103. var _this = $("#"+ele);
  104. _this.hide();
  105. $(".dim").remove();
  106. }