$(function(){ //view_more var thisClickTop = []; var thisOffsetTop = 0; var contentHeight = 0; var tableContentHeight = 0; var bodyH = 0; var windowH = $(window).height(); var backPoint = 0; var footerH = $("#Footer").outerHeight(); var trContentHeight = 0; var scrollH = 0; var item = {}; item.index = 0; item.top = 0; item.display = false; thisClickTop.push(item); var matchItem = {}; // item.map(a => { // if (a.index == index) { // // } // }) matchItem.top; $.each($(".btk-content-wrapper"),function(){ var trLength = $(this).find(".btk-pro-table").children("table:first-child").children("tbody").children("tr").length; //console.log(trLength) if(trLength <= 4){ $(this).find(".view_collapse").hide(); }else { $(this).find(".view_collapse").show(); } }) $(".btn-gene-filter").on("click", function(e) { e.stopPropagation(); $(".ahr-filter-list").toggle(); }) $(".ahr-filter-list").on("click", function(e){ e.stopPropagation(); }) $.each($('#main .view_collapse span'),function(){ $(this).on('click',function(event){ if($(this).attr("class") == "view_more"){ var clickTop = $(this).closest('.btk-content-wrapper').offset().top; thisClickTop = clickTop; $(this).parent().prev('.btk-pro-table').children('table:first-child').children("tbody").children("tr").css("display","table-row"); $(this).siblings('.collapse').css("display","inline"); $(this).css("display","none"); thisOffsetTop = clickTop; trContentHeight = $(this).parent().prev('.btk-pro-table').find('table:first-child tr').outerHeight(); var trNumber = $(this).parent().prev('.btk-pro-table').children('table:first-child').children("tbody").children("tr").length; contentHeight = parseInt(trContentHeight * trNumber); // bodyH = document.body.scrollHeight + contentHeight; // backTop(bodyH); // console.log("tr height * number :"+ contentHeight) // if($(this).parent().prev('.btk-pro-table').find('table:first-child tr').length > 20){ // toGoTop($(this).closest(".btk-content-wrapper"),thisOffsetTop,contentHeight); // } $(this).closest(".btk-content-wrapper").find(".btn-add").removeClass('is-down'); }else { $(this).parent().prev('.btk-pro-table').children('table:first-child').children("tbody").children("tr").css("display",""); $(this).siblings('.view_more').css("display","inline"); $(this).css("display","none"); contentHeight = $(this).parent().prev('.btk-pro-table').children('table:first-child').outerHeight(); // if(contentHeight < 500){ // toGoTop($(this).closest(".btk-content-wrapper"),0,0); // } //$(this).closest(".btk-content-wrapper").find(".right-floating-to-top").hide(); $(document).scrollTop(thisClickTop - 88); var lftCtusH = ($(window).height() - $("#lft_ctus").outerHeight())/2; $("#lft_ctus").stop(true).css("top",lftCtusH); $(this).closest(".btk-content-wrapper").find(".btn-add").addClass('is-down'); } }) }); //angle arrow function initBtnAngle() { $.each($('.btn-angle'),function(){ $(this).unbind("click").on('click',function(event){ if($(this).parent("td").hasClass("vt") === false){ $(this).parent("td").toggleClass("vt"); } //$(this).toggleClass('rotate-arrow'); $(this).parent().prev('.content-inner').toggleClass("is-show"); if($(this).parent().next("table").is(":hidden") || $(this).parent().prev('.content-inner').hasClass("is-show")){ $(this).addClass('rotate-arrow'); $(this).parent().next("table").show().css("marginBottom", "27px"); $(this).closest('.btk-pro-table').siblings(".toggle-control-area").find(".btn-add").removeClass("is-down"); }else { $(this).removeClass('rotate-arrow'); $(this).parent().next("table").hide().css("marginBottom", "0px"); $(this).closest('.btk-pro-table').siblings(".toggle-control-area").find(".btn-add").addClass("is-down"); } thisOffsetTop = $(this).offset().top; contentHeight = $(this).closest(".btk-pro-table").find("table").outerHeight(); // bodyH = document.body.scrollHeight + contentHeight; // backTop(bodyH); // console.log("number"+ $(this).closest(".btk-pro-table").find("table").find("tr").length) // console.log("contentHeight: "+ contentHeight) // if ($(this).closest('.btk-pro-table').hasClass('table-type04') === false){ // if($(this).closest('.btk-pro-table').find("table tr").length > 20 && contentHeight > 500){ // toGoTop($(this).closest(".btk-pro-table"),thisOffsetTop,contentHeight); // } // } // if ($(this).parent().siblings(".content-inner").find("table").is(":hidden") || $(this).closest(".flex-default").siblings("table").is(":hidden")){ // toGoTop($(this).closest('.btk-pro-table'),0,0); // } }); }); } window.initBtnAngle = initBtnAngle; initBtnAngle(); $(".btn-panel").on("click",function(){ $(this).next('.btn-angle').click(); }) // function toGoTop(that,thisOffsetTop,contentHeight){ // var scrollTop = $(document).scrollTop(); // var floatTop = parseInt(thisOffsetTop - 400); // var floatBottom = parseInt((floatTop + contentHeight) - 70); // // console.log("floatTop:"+ floatTop) // // console.log("scrollTop:"+ scrollTop); // // console.log("floatBottom:"+ floatBottom); // $(window).scroll(function() { // scrollTop = $(document).scrollTop(); // //console.log("scrollTop2222:"+scrollTop); // if(scrollTop >= floatTop <= floatBottom){ // $(that).find(".right-floating-to-top").show(); // }else { // $(that).find(".right-floating-to-top").hide(); // } // if (scrollTop < thisOffsetTop){ // $(that).find(".right-floating-to-top").hide(); // } // if (scrollTop > floatBottom) { // $(that).find(".right-floating-to-top").hide(); // // $(that).find(".right-floating-to-top").css({"position":"absolute","top": contentHeight + 10,"left":"100%"}); // }else { // $(that).find(".right-floating-to-top").css({"position":"fixed","top":"50%","left":"calc(75% + 40px)"}); // } // }); // $(that).find(".right-floating-to-top").on("click",function(){ // $(document).scrollTop(thisOffsetTop - 88); // }) // } //search onfocus $('.search-box input[type=text]').focus(function(){ $(this).siblings("span").addClass('icon-search-black').removeClass("icon-search-gray"); $(this).parent().addClass("is-active"); }) $('.search-box input[type=text]').blur(function(){ $(this).siblings("span").addClass('icon-search-gray').removeClass("icon-search-black"); $(this).parent().removeClass("is-active"); }); // all pull-down $.each($('.toggle-control-area .btn-add'),function(){ $(this).on('click',function(){ var proTable = $(this).parent().siblings('.btk-pro-table'); thisOffsetTop = $(this).offset().top; //$(this).closest(".btk-content-wrapper").toggleClass('rotate-arrow').parent("td").toggleClass("vt"); if ($(proTable).hasClass('table-type04')){ if($(this).hasClass("is-down")){ $(this).removeClass('is-down'); if($(proTable).find('.content-inner').find("tr").length >= 1){ $(proTable).find('.content-inner').addClass("is-show"); } $(proTable).children('table:first-child').children("tbody").children("tr").css("display","table-row"); $(proTable).find(".btn-angle").addClass('rotate-arrow').parent("td").addClass("vt"); $(this).parent(".toggle-control-area").siblings('.view_collapse').children(".collapse").css("display","inline"); $(this).parent(".toggle-control-area").siblings('.view_collapse').children(".view_more").css("display","none"); tableContentHeight = $(proTable).find('table').outerHeight(); contentHeight = parseInt(tableContentHeight); // if($(proTable).find("table tr").length > 20 && contentHeight > 500){ // toGoTop(proTable,thisOffsetTop,contentHeight); // } // bodyH = document.body.scrollHeight + contentHeight; // backTop(bodyH); }else { $(this).addClass('is-down'); $(proTable).find('.content-inner').removeClass("is-show"); $(proTable).find(".btn-angle").removeClass('rotate-arrow').parent("td").removeClass("vt"); $(proTable).children('table:first-child').children("tbody").children("tr").css("display",""); $(this).parent(".toggle-control-area").siblings('.view_collapse').children(".view_more").css("display","inline"); $(this).parent(".toggle-control-area").siblings('.view_collapse').children(".collapse").css("display","none"); contentHeight = $(proTable).find('table').outerHeight(); // if (contentHeight < 500){ // toGoTop(proTable,0,0); // } // bodyH = document.body.scrollHeight + contentHeight; // backTop(bodyH); } }else { if($(proTable).find("table").is(":hidden") && $(this).hasClass("is-down")) { $(this).removeClass('is-down'); $(proTable).find(".btn-angle").addClass('rotate-arrow').parent("td").addClass("vt"); $(proTable).find("table").show().css("marginBottom", "27px");; var allContentHeight = $(proTable).parent(".btk-content-card").outerHeight(); contentHeight = parseInt($(proTable).find('table').outerHeight()); // if($(proTable).find("table tr").length > 20 && allContentHeight > 500){ // toGoTop(proTable,thisOffsetTop,allContentHeight); // } // bodyH = document.body.scrollHeight + contentHeight; // backTop(bodyH); }else { $(this).addClass('is-down'); $(proTable).find(".btn-angle").removeClass('rotate-arrow').parent("td").removeClass("vt"); $(proTable).find("table").hide().css("marginBottom", "0px"); // bodyH = document.body.scrollHeight + contentHeight; // backTop(bodyH); // if($(this).closest(".btk-content-card").find("table").is(":hidden")){ // toGoTop(proTable,0,0); // } } } }) }); // card-tooltip $.each($(".bg-panel .pro-card-item"), function() { var colorBlock = $(this).outerWidth(); var nameW = $(this).find("span").outerWidth(); if (colorBlock < nameW / 2) { $(this).find("span").hide(); } else if(colorBlock < nameW + 10){ $(this).find("span").addClass("text-ellipsis"); } $(this).mouseenter(function() { $(this).find('.card-tooltip').show(); }) $(this).mouseleave(function() { $(this).find('.card-tooltip').hide(); }) }); //Back top // function backTop (bodyH){ // bodyH = $(document).height(); // backPoint = bodyH - footerH - windowH; // scrollH = $(document).scrollTop(); // //console.log("backPoint: "+backPoint,"scrollH:" + scrollH,"bodyH: "+ bodyH); // $(window).scroll(function(){ // scrollH = $(document).scrollTop(); // if(scrollH >= backPoint){ // $(".back-top").show(); // }else { // $(".back-top").hide(); // } // }); // } // $(".back-top").on("click",function(){ // $("html,body").animate({ // scrollTop: 0 // }) // }); // backTop(); //nav bar var navBarTop = $(".navigation-bars").offset().top; var headH = 88; var navScrollH = $(document).scrollTop(); var boxTop = 0; var titH = $('.second-tit').outerHeight(true); //console.log("navBarTop:"+navBarTop,"headH:"+headH) var flag = 0; function navBar() { if(navScrollH > navBarTop - headH){ flag = 1; $(".navigation-bars").css({"position":"fixed","top": headH ,"marginTop": "0px"}); }else { flag = 0; $(".navigation-bars").css({"position":"static","top": "","marginTop": "20px"}); } $.each($("[data-page]"),function(index){ if(navScrollH > $("[data-page]").eq(index).offset().top - headH - 61) { $(".navigation-bars ul").find("li").eq(index).addClass("is-active").siblings().removeClass("is-active"); } }); } navBar(); $(".navigation-bars ul").find("li").on("click",function(){ // console.log("click:"+$("[data-page]").eq($(this).index()).offset().top) boxTop = $("[data-page]").eq($(this).index()).offset().top; $(this).addClass("is-active").siblings().removeClass("is-active"); $(document).scrollTop(boxTop - headH - (flag === 1 ? 60 : 118 )); }); $(window).scroll(function(){ navScrollH = $(document).scrollTop(); //console.log(navScrollH) navBar(); }); //selected // $(".btk-filter-wrap > button").on('click',function(e){ // e.stopPropagation(); // if($(this).siblings(".btk-filter-list").is(":hidden")){ // $(".btk-filter-list").hide(); // $(this).siblings(".btk-filter-list").show(); // }else { // $(this).siblings(".btk-filter-list").hide(); // } // }); $(".btk-filter-list").on("click",function(e){ e.stopPropagation(); }) $(document).on("click",function (){ $(".btk-filter-list,.ahr-filter-list").hide(); }) $('#related-agents').find('table').each(function (tIndex, trDom) { var effects = []; $(this).find('[data-effects-value]').each(function (index, trDom) { var arr = $(this).text().split(';'); arr.map(item => { if ($.inArray(item.trim(), effects) == -1) { effects.push(item.trim()); } }) }); if (effects.length > 0) { var html = ''; effects.map((item, index) => { html += '