//搴曢儴灞曞紑
function collspe(titDom, dom) {
$(dom).hide(); //绗竴涓笉闅愯棌
// $(".arrow_more:first").css("transform", "rotate(-180deg)"); //绗竴涓嬬澶存湞涓
$(titDom).click(function () {
if ($(this).siblings(dom).is(":hidden")) {
//褰撳墠鐐瑰嚮鐨?content闅愯棌
$(`${dom}:visible`).slideUp(300);
$(this).siblings(dom).slideDown(300);
$(".arrow_more").css("transform", "rotate(0deg)");
$(this).find(".arrow_more").css("transform", "rotate(-180deg)");
} else {
$(`${dom}:visible`).slideUp(300);
$(this).find(".arrow_more").css("transform", "rotate(0deg)");
}
});
}
//瀵艰埅灞曞紑
function navcollaspe(titDom, dom) {
$(dom + ":not(:first)").hide();
$(dom + ':eq(11)').show();//鏁板瓧骞冲彴榛樿鏄剧ず
$(dom+":eq(12)").show();//琛屼笟鏂规榛樿鏄剧ず
// $(dom).hide(); //绗竴涓笉闅愯棌
$('.arrow_more:first,.arrow_more:eq(11),.arrow_more:eq(12)').css('transform','rotate(-180deg)') //绗竴涓嬬澶存湞涓
$(titDom).click(function () {
if ($(this).next().is(":hidden")) {
//褰撳墠鐐瑰嚮鐨?content闅愯棌
$(`${dom}:visible`).slideUp(300);
$(this).next().slideDown(300);
$(".arrow_more").css("transform", "rotate(0deg)");
$(this).find(".arrow_more").css("transform", "rotate(-180deg)");
} else {
$(`${dom}:visible`).slideUp(300);
$(this).find(".arrow_more").css("transform", "rotate(0deg)");
}
});
}
//甯﹁繘搴︽潯杞挱鍥 婊戝姩 鍙樺寲鏁板瓧
function mobilerenderScheduleSwipermouse2(dom) {
var mySwipers = new Swiper(dom, {
// loop: true, // 寰幆妯″紡閫夐」
slidesPerView: "auto",
// centeredSlides: true,
// centeredSlidesBounds: true,
// spaceBetween: 20,
autoplay: {
disableOnInteraction: true,
delay: 5000,
},
pagination: {
el: ".swiper-paginations",
clickable: true,
},
});
}
// Swiper鍙í鍚戞粦鍔 nav 瀹㈡埛妗堜緥
function Swipernav() {
var mySwipernav = new Swiper(".case_box-nav .swiper-container", {
slidesPerView: "auto",
spaceBetween: 40,
thumbs: {
swiper: {
el: ".gallery-thumbs",
// slidesOffsetBefore: 20, //鏈€宸︿晶璺濊竟缂?8px
// slidesOffsetAfter: 20, //鏈€鍙充晶璺濊竟缂?0px
spaceBetween: 40,
slidesPerView: "auto",
watchSlidesVisibility: true,
watchSlidesProgress: true,
},
autoScrollOffset: 4,
},
});
}
// 姣忎釜椤甸潰nav婊戝姩缃戦〉锛屽惛椤
function mobilenavSwiper() {
$(function () {
f22();
});
function f22() {
let totalWidth = 0;
$(".intro_nav_tip").each(function () {
totalWidth += $(this).outerWidth() + 20;
});
$(".swiper-nav .swiper-wrapper").css("width", totalWidth);
if ($(".swiper-nav").outerWidth() > totalWidth) {
$(".swiper-nav .swiper-wrapper").css("transform", "none");
}
}
//
let mySwipersss = new Swiper(".swiper-nav", {
slidesPerView: "auto",
spaceBetween: 20, //闂磋窛
slidesOffsetBefore: 20, //鏈€宸︿晶璺濊竟缂?0px
slidesOffsetAfter: 20, //鏈€鍙充晶璺濊竟缂?0px
// slideToClickedSlide: true,
// centeredSlides: true,//灞呬腑
// centeredSlidesBounds: true,//涓よ竟闈犺竟
// freeMode: true,
});
// // 鍥哄畾瀵艰埅鏍
var oTop = $(".intro_nav_box").offset().top;
var martop = $(".intro_nav").outerHeight();
$(".intro_nav .intro_nav_tip").click(function () {
var index = $(this).index();
// $(this).addClass('curentss').siblings().removeClass('curentss')
// mySwipersss.slideTo(index, 1000, false);
// console.log(index)
$(".scroll_comment").each(function (key) {
if (index === key) {
var signHeight = $(this).offset().top;
$("html,body").animate({ scrollTop: signHeight - 40 }, 700);
}
});
});
//椤甸潰婊氬姩
$(window).scroll(function () {
// console.log(document.documentElement.scrollTop/10)
sTop = $(this).scrollTop();
if (sTop >= oTop) {
$(".intro_nav_box").css({
position: "fixed",
top: "0",
"z-index": "99999",
});
$(".scroll_a").css({ "margin-top": martop });
} else {
$(".intro_nav_box").css({ position: "static" });
$(".scroll_a").css({ "margin-top": "0" });
}
mobileunderline();
f22();
});
//涓嬪垝绾
function mobileunderline() {
var res1 = $(".scroll_a").offset().top - document.documentElement.scrollTop;
var res2 = $(".scroll_b").offset().top - document.documentElement.scrollTop; //998-y
if ($(".scroll_c").length > 0) {
var res3 =
$(".scroll_c").offset().top - document.documentElement.scrollTop;
}
if ($(".scroll_d").length > 0) {
var res4 =
$(".scroll_d").offset().top - document.documentElement.scrollTop;
}
if ($(".scroll_e").length > 0) {
var res5 =
$(".scroll_e").offset().top - document.documentElement.scrollTop;
}
if ($(".scroll_f").length > 0) {
var res6 =
$(".scroll_f").offset().top - document.documentElement.scrollTop;
}
if ($(".scroll_g").length > 0) {
var res7 =
$(".scroll_g").offset().top - document.documentElement.scrollTop;
}
if (res1 < 41 && res1 > -$(".scroll_a").height() - 40) {
$(".intro_nav_tip:eq(0)")
.addClass("curentss")
.siblings()
.removeClass("curentss");
mySwipersss.slideTo(0, 1000, false);
}
if (res2 < 41 && res2 > -$(".scroll_b").height() - 40) {
$(".intro_nav_tip:eq(1)")
.addClass("curentss")
.siblings()
.removeClass("curentss");
mySwipersss.slideTo(1, 1000, false);
}
if (res3 < 41 && res3 > -$(".scroll_c").height() - 40) {
$(".intro_nav_tip:eq(2)")
.addClass("curentss")
.siblings()
.removeClass("curentss");
mySwipersss.slideTo(2, 1000, false);
}
if ($(".scroll_d").length > 0) {
if (res4 < 41 && res4 > -$(".scroll_d").height() - 40) {
$(".intro_nav_tip:eq(3)")
.addClass("curentss")
.siblings()
.removeClass("curentss");
mySwipersss.slideTo(3, 1000, false);
}
}
if ($(".scroll_e").length > 0) {
if (res5 < 41 && res5 > -$(".scroll_e").height() - 40) {
$(".intro_nav_tip:eq(4)")
.addClass("curentss")
.siblings()
.removeClass("curentss");
mySwipersss.slideTo(4, 1000, false);
}
}
if ($(".scroll_f").length > 0) {
if (res6 < 41 && res6 > -$(".scroll_f").height() - 40) {
$(".intro_nav_tip:eq(5)")
.addClass("curentss")
.siblings()
.removeClass("curentss");
mySwipersss.slideTo(5, 1000, false);
}
}
if ($(".scroll_g").length > 0) {
if (res7 < 41 && res7 > -$(".scroll_g").height() - 40) {
$(".intro_nav_tip:eq(6)")
.addClass("curentss")
.siblings()
.removeClass("curentss");
mySwipersss.slideTo(6, 1000, false);
}
}
}
}
//瀵艰埅鏍
function mobilenavigation() {
var p = 0,
t = 0;
var bannerHeight =
parseInt($(".banner-product").height()) +
parseInt($(".banner-product").css("padding-top")) +
parseInt($(".banner-product").css("padding-bottom"));
$(window).scroll(function () {
p = $(this).scrollTop();
if (t < p) {
//涓嬫粴
$(".intro_nav_box").css({ "z-index": "9999" });
if (document.documentElement.scrollTop > bannerHeight) {
$(".header").css({ opacity: "0", transition: "all .3s" });
}
} else {
//涓婃粴
$(".intro_nav_box").css({ "z-index": "999" });
$(".header").css({ opacity: "1", transition: "all .3s" });
}
setTimeout(function () {
t = p;
}, 0);
});
}
//鍙充晶tab鍥哄畾
$(document).scroll(function () {
var scrollTop = $(document).scrollTop();
if (scrollTop > 560) {
$(".wrap-dropdown").addClass("wrap-dropdown-fix");
} else {
$(".wrap-dropdown").removeClass("wrap-dropdown-fix");
}
$(".contain-wrap-item").each(function () {
var index = $(this).index() - 1;
var itemTop = $(this).offset().top;
var itemHeight = $(this).height();
if (itemTop - scrollTop < 400 && itemTop + itemHeight - scrollTop > 400) {
$(this).find(".contain-wrap-content").slideDown("300");
var pointedNode = $(".wrap-dropdown").find("li").eq(index);
pointedNode.css("color", "#4DB7DD").siblings().css("color", "#090F21");
pointedNode.closest(".wrap-ul").slideDown();
var parentIndex = pointedNode.closest(".wrap-content").parent().index();
$(`.wrap-content .wrap-ul:lt(${parentIndex})`).slideUp();
$(`.wrap-content .wrap-ul:gt(${parentIndex})`).slideUp();
$(`.contain-wrap-item .wrap-date:eq(${index})`).css({
color: "#4DB7DD",
opacity: "1",
});
$(`.contain-wrap-item .date-circle:eq(${index})`).addClass("change");
}
});
});
//鍙充晶tab鐐瑰嚮鏁堟灉
$(".wrap-dropdown > div ").each(function (index) {
$(this)
.find(".date-button")
.click(function () {
$(`.wrap-content .wrap-ul:eq(${index})`)
.slideToggle()
.css("display", "inline-block");
$(`.wrap-content .wrap-ul:lt(${index})`).slideUp();
$(`.wrap-content .wrap-ul:gt(${index})`).slideUp();
});
});
$(".wrap-dropdown .wrap-ul li").click(function () {
var _this = $(this)[0].innerText;
$(".contain-wrap-item")
.find(".wrap-date")
.each(function (index) {
if ($(this)[0].innerText === _this) {
$("html,body").animate({ scrollTop: $(this).offset().top - 150 }, 700);
}
});
});
function showHonourList(list, boxDom) {
list.forEach((item, index) => {
$(`
${item.number}
${item.title}
${item.description}
`).appendTo(boxDom);
});
$(".contain-wrap-item:eq(0) .date-circle").css("top", "17px");
$(".contain-wrap-item:eq(0) .wrap-date").css("padding-top", "12px");
}
//闄勫甫杩涘害鏉$殑杞挱锛堝彲榧犳爣瑕嗙洊鍒囨崲锛
function mobilerenderScheduleSwipermouse(dom) {
var mouseSwiper = new Swiper(dom, {
direction: "horizontal",
loop: true, // 寰幆妯″紡閫夐」
autoplay: {
disableOnInteraction: false,
delay: 5000,
},
navigation: {
disabledClass: "my-button-disabled",
hideOnClick: true,
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
bulletElement: "li",
},
});
for (i = 0; i < mouseSwiper.pagination.bullets.length; i++) {
mouseSwiper.pagination.bullets[i].onmouseover = function () {
this.click();
};
}
}
//涓€涓〉闈㈠涓 闄勫甫杩涘害鏉$殑杞挱锛堝彲榧犳爣瑕嗙洊鍒囨崲锛
function mobilerenderMoreSwipermouse(dom) {
var Pagename = ".swiper-pagination" + dom.slice(16, 17);
var NextnavName = ".swiper-button-next" + dom.slice(16, 17);
var PrevnavName = ".swiper-button-prev" + dom.slice(16, 17);
var mouseSwiper1 = new Swiper(dom, {
direction: "horizontal",
loop: true, // 寰幆妯″紡閫夐」
autoplay: {
disableOnInteraction: false,
delay: 5000,
},
navigation: {
disabledClass: "my-button-disabled",
hideOnClick: true,
nextEl: NextnavName,
prevEl: PrevnavName,
},
pagination: {
el: Pagename,
clickable: true,
bulletElement: "li",
},
});
}
// 鎴戜滑鐨勭壒鐐
// 琛屼笟 瀹㈡埛浠峰€ 鐧藉簳鐧芥 鏃犳í绾 rzh-card-content
function mobileourtedian(list, boxDom) {
list.forEach((item, index) => {
$(`
${item.title}
`).appendTo(boxDom);
});
}
// 鎴戜滑鐨勭壒鐐瑰甫鍥剧墖
function mobileourtedianWithimg(list, boxDom) {
list.forEach((item, index) => {
$(`
${item.title}
`).appendTo(boxDom);
});
}
// 鎴戜滑鐨勭壒鐐瑰甫鍥剧墖鍒嗘
function mobileourtedianWithimgPara(list, boxDom) {
list.forEach((item, index) => {
$(`
${item.para1}
${item.description1}
${item.para2}
${item.description2}
${item.para3}
${item.description3}
`).appendTo(boxDom);
});
}
//甯﹁繘搴︽潯杞挱鍥 婊戝姩 鍙樺寲鏁板瓧
function mobilerenderScheduleSwipermouse2(dom) {
var mySwipers = new Swiper(dom, {
// loop: true, // 寰幆妯″紡閫夐」
slidesPerView: 'auto',
// centeredSlides: true,
// centeredSlidesBounds: true,
// spaceBetween: 20,
autoplay: {
disableOnInteraction: true,
delay: 5000,
},
pagination: {
el: '.swiper-paginations',
clickable: true,
},
});
}
function mobilenavSwiper() {
$(function () {
f22()
})
function f22() {
let totalWidth = 0;
$('.intro_nav_tip').each(function () {
totalWidth += $(this).outerWidth() + 20;
});
$(".swiper-nav .swiper-wrapper").css("width", totalWidth)
if ($(".swiper-nav").outerWidth() > totalWidth) {
$(".swiper-nav .swiper-wrapper").css("transform", "none")
}
}
//
let mySwipersss = new Swiper('.swiper-nav', {
slidesPerView: "auto",
spaceBetween: 20, //闂磋窛
slidesOffsetBefore : 20,//鏈€宸︿晶璺濊竟缂?0px
slidesOffsetAfter:20, //鏈€鍙充晶璺濊竟缂?0px
// slideToClickedSlide: true,
// centeredSlides: true,//灞呬腑
// centeredSlidesBounds: true,//涓よ竟闈犺竟
// freeMode: true,
});
// // 鍥哄畾瀵艰埅鏍
var oTop = $(".intro_nav_box").offset().top;
var martop = $('.intro_nav').outerHeight();
$('.intro_nav .intro_nav_tip').click(function () {
var index = $(this).index()
// $(this).addClass('curentss').siblings().removeClass('curentss')
// mySwipersss.slideTo(index, 1000, false);
// console.log(index)
$('.scroll_comment').each(function (key) {
if (index === key) {
var signHeight = $(this).offset().top
$('html,body').animate({scrollTop: (signHeight - 40)}, 700);
}
})
})
//椤甸潰婊氬姩
$(window).scroll(function () {
// console.log(document.documentElement.scrollTop/10)
sTop = $(this).scrollTop();
if (sTop >= oTop) {
$(".intro_nav_box").css({"position": "fixed", "top": "0", "z-index": "99999"});
$(".scroll_a").css({"margin-top": martop});
} else {
$(".intro_nav_box").css({"position": "static"});
$(".scroll_a").css({"margin-top": "0"});
}
mobileunderline();
f22();
})
//涓嬪垝绾
function mobileunderline() {
var res1 = $(".scroll_a").offset().top - document.documentElement.scrollTop;
var res2 = $(".scroll_b").offset().top - document.documentElement.scrollTop; //998-y
var res3 = $(".scroll_c").offset().top - document.documentElement.scrollTop;
if($(".scroll_d").length>0) {
var res4 = $(".scroll_d").offset().top - document.documentElement.scrollTop;
}
if($(".scroll_e").length>0) {
var res5 = $(".scroll_e").offset().top - document.documentElement.scrollTop;
}
if($(".scroll_f").length>0) {
var res6 = $(".scroll_f").offset().top - document.documentElement.scrollTop;
}
if($(".scroll_g").length>0) {
var res7 = $(".scroll_g").offset().top - document.documentElement.scrollTop;
}
if (res1 < 41 && res1 > -$(".scroll_a").height() - 40) {
$(".intro_nav_tip:eq(0)").addClass("curentss").siblings().removeClass("curentss")
mySwipersss.slideTo(0, 1000, false);
}
if (res2 < 41 && res2 > -$(".scroll_b").height() - 40) {
$(".intro_nav_tip:eq(1)").addClass("curentss").siblings().removeClass("curentss")
mySwipersss.slideTo(1, 1000, false);
}
if (res3 < 41 && res3 > -$(".scroll_c").height() - 40) {
$(".intro_nav_tip:eq(2)").addClass("curentss").siblings().removeClass("curentss")
mySwipersss.slideTo(2, 1000, false);
}
if($(".scroll_d").length>0) {
if (res4 < 41 && res4 > -$(".scroll_d").height() - 40) {
$(".intro_nav_tip:eq(3)").addClass("curentss").siblings().removeClass("curentss")
mySwipersss.slideTo(3, 1000, false);
}
}
if($(".scroll_e").length>0) {
if (res5 < 41 && res5 > -$(".scroll_e").height() - 40) {
$(".intro_nav_tip:eq(4)").addClass("curentss").siblings().removeClass("curentss")
mySwipersss.slideTo(4, 1000, false);
}
}
if($(".scroll_f").length>0) {
if (res6 < 41 && res6 > -$(".scroll_f").height() - 40) {
$(".intro_nav_tip:eq(5)").addClass("curentss").siblings().removeClass("curentss")
mySwipersss.slideTo(5, 1000, false);
}
}
if($(".scroll_g").length>0) {
if (res7 < 41 && res7 > -$(".scroll_g").height() - 40) {
$(".intro_nav_tip:eq(6)").addClass("curentss").siblings().removeClass("curentss")
mySwipersss.slideTo(6, 1000, false);
}
}
}
}
//瀵艰埅鏍
function mobilenavigation() {
var p = 0,
t = 0;
var bannerHeight=
parseInt($('.banner-product').height())+
parseInt($('.banner-product').css('padding-top'))+parseInt($('.banner-product').css('padding-bottom'))
console.log(bannerHeight)
$(window).scroll(function () {
p = $(this).scrollTop();
if (t < p) {
//涓嬫粴
$(".intro_nav_box").css({"z-index": "9999"})
if (document.documentElement.scrollTop > bannerHeight) {
$(".header").css({"opacity": "0", "transition": "all .3s"})
}
} else {
//涓婃粴
$(".intro_nav_box").css({"z-index": "999"})
$(".header").css({"opacity": "1", "transition": "all .3s"})
}
setTimeout(function () {
t = p;
}, 0)
})
}
//鍙充晶tab鍥哄畾
$(document).scroll(function () {
var scrollTop = $(document).scrollTop()
if (scrollTop > 560) {
$('.wrap-dropdown').addClass('wrap-dropdown-fix')
} else {
$('.wrap-dropdown').removeClass('wrap-dropdown-fix')
}
$('.contain-wrap-item').each(function () {
var index = $(this).index() - 1
var itemTop = $(this).offset().top
var itemHeight = $(this).height()
if (itemTop - scrollTop < 400 && itemTop + itemHeight - scrollTop > 400) {
$(this).find('.contain-wrap-content').slideDown('300')
var pointedNode = $('.wrap-dropdown').find('li').eq(index);
pointedNode.css('color', '#4DB7DD').siblings().css("color", "#090F21");
pointedNode.closest('.wrap-ul').slideDown();
var parentIndex = pointedNode.closest('.wrap-content').parent().index();
$(`.wrap-content .wrap-ul:lt(${parentIndex})`).slideUp();
$(`.wrap-content .wrap-ul:gt(${parentIndex})`).slideUp();
$(`.contain-wrap-item .wrap-date:eq(${index})`).css({"color": "#4DB7DD", "opacity": "1"})
$(`.contain-wrap-item .date-circle:eq(${index})`).addClass("change");
}
})
})
//鍙充晶tab鐐瑰嚮鏁堟灉
$('.wrap-dropdown > div ').each(function (index) {
$(this).find('.date-button').click(function () {
$(`.wrap-content .wrap-ul:eq(${index})`).slideToggle().css('display', 'inline-block')
$(`.wrap-content .wrap-ul:lt(${index})`).slideUp()
$(`.wrap-content .wrap-ul:gt(${index})`).slideUp()
})
})
$('.wrap-dropdown .wrap-ul li').click(function () {
var _this = $(this)[0].innerText
$('.contain-wrap-item').find('.wrap-date').each(function (index) {
if ($(this)[0].innerText === _this) {
$('html,body').animate({scrollTop: ($(this).offset().top - 150)}, 700);
}
})
})
function showHonourList(list, boxDom) {
list.forEach((item, index) => {
$(`
${item.number}
${item.title}
${item.description}
`).appendTo(boxDom)
})
$(".contain-wrap-item:eq(0) .date-circle").css("top", "17px")
$(".contain-wrap-item:eq(0) .wrap-date").css("padding-top", "12px")
}
//闄勫甫杩涘害鏉$殑杞挱锛堝彲榧犳爣瑕嗙洊鍒囨崲锛
function mobilerenderScheduleSwipermouse(dom) {
var mouseSwiper = new Swiper(dom, {
direction: 'horizontal',
loop: true, // 寰幆妯″紡閫夐」
autoplay: {
disableOnInteraction: false,
delay: 5000,
},
pagination: {
el: '.swiper-pagination',
clickable: true,
bulletElement: 'li',
}
});
for(i=0;i {
$(`
${item.title}
`).appendTo(boxDom)
})
}
// 鎴戜滑鐨勭壒鐐瑰甫鍥剧墖
function mobileourtedianWithimg(list, boxDom) {
list.forEach((item, index) => {
$(`
${item.title}
`).appendTo(boxDom)
})
}
// 鎴戜滑鐨勭壒鐐瑰甫鍥剧墖鍒嗘
function mobileourtedianWithimgPara(list, boxDom) {
list.forEach((item, index) => {
$(`
${item.para1}
${item.description1}
${item.para2}
${item.description2}
${item.para3}
${item.description3}
`).appendTo(boxDom)
})
}
//鎴戜滑鐨勭壒鐐瑰睍寮€鏀惰捣
function mobiledoTedian(dom1, dom2, dom3) {
$(dom2 + ":not(:first)").hide(); //绗竴涓笉闅愯棌
$(dom3 + ":first").css("transform", "rotate(-180deg)"); //绗竴涓嬬澶存湞涓
$(`${dom1}:eq(0) .industrial-park-text`).css("color", "#4DB7DD")
$(`${dom1}:eq(0) .industrial-park-hr`).css("opacity", "0") //绗竴涓病鏈塰r妯嚎
$(dom1).click(function () {
if ($(this).find(dom2).is(':hidden')) { //褰撳墠鐐瑰嚮鐨勬槸闅愯棌
$(dom2 + ":visible").slideUp(300);
$(this).children(dom2).slideDown(300);
$(dom3).css("transform", "rotate(0deg)");
$(this).find(dom3).css("transform", "rotate(-180deg)");
$(".industrial-park-hr").css("opacity", "1")
$(this).children(".industrial-park-hr").css("opacity", "0")
if ($(dom2).is(':hidden')) {
$(`${dom1} .industrial-park-text`).css("color", "#090F21")
}
$(this).find(".industrial-park-text").css("color", "#4DB7DD")
} else {
$(dom2 + ":visible").slideUp(300);
$(this).find(dom3).css("transform", "rotate(0deg)");
$(this).find(".industrial-park-text").css("color", "#090F21")
$(".industrial-park-hr").css("opacity", "1")
}
});
}
//
//璁$畻鍐呭鐨勯珮搴 鏉ュ垽鏂槸澶氬皯琛
function getHeight(dom1, dom2) {
let wareNameText = $(dom1).text();//鑾峰彇鍐呭
let wareNameText1 = $(dom1).text();//鑾峰彇鍐呭 ----涓嶈兘鍙樼殑鏁版嵁
let newText1 = wareNameText1 + '鏀惰捣';
let heightSome = $(dom1).outerHeight();//鑾峰彇鍐呭褰撳墠鐨勯珮搴
let heightSome1 = $(dom1).outerHeight();
//杩欎釜鏁板瓧鏄洓琛岀殑鏃跺€欑殑楂樺害锛屾牴鎹綘璁惧畾鐨勫瓧浣撳ぇ灏忔湁鍏
if (heightSome > 120) {
for (i = 0; heightSome > 120; i++) {
//姣忔鍒犳帀鏈€鍚庝竴涓劧鍚庤繑鍥
wareNameText = wareNameText.substring(0, wareNameText.length - 1);
//閲嶆柊杩斿洖鐨勫瓧绗﹀湪鍐欏湪div閲岄潰 锛岃绠楁柊鐨勯珮搴
heightSome = $(dom1).text(wareNameText).outerHeight();
}
//寰楀埌姝eソ绗﹀悎楂樺害鐨勫瓧绗︼紝鍒犻櫎鏈€鍚?涓彉涓虹渷鐣ュ彿 濉厖鍦ㄩ〉闈㈤噷
newText = wareNameText.substring(0, wareNameText.length - 5) + '...';
$(dom1).text(newText);
}
let wareNameText2 = wareNameText.substring(0, wareNameText.length - 5) + '...';//鑾峰彇鎴彇鐨勬枃鏈
$(dom2).click(function () {
$(dom2).hide();
$(dom1).html(newText1);
});
// jQuery缁欏姩鎬佹坊鍔犵殑鍏冪礌鍔犵偣鍑讳簨浠跺け鏁堢殑鍘熷洜浠ュ強瑙e喅鍔炴硶
$(dom1).on("click", ".close-all", function () {
$(`${dom1} .close-all`).hide();
$(dom1).html(wareNameText2);
$(dom2).show();
});
}
//璁剧疆cookie
function setCookie(name, value, iDay) {
var oDate = new Date();
oDate.setDate(oDate.getDate() + iDay);
document.cookie = name + "=" + value + ";expires=" + oDate;
}
//鑾峰彇cookie
function getCookie(name) {
var arr = document.cookie.split('; '); //鐢ㄢ€淃鈥濆拰绌烘牸鏉ュ垝鍒哻ookie
for (var i = 0; i < arr.length; i++) {
var arr2 = arr[i].split("=");
if (arr2[0] == name) {
return arr2[1];
}
}
return ""; //鏁翠釜閬嶅巻瀹屾病鎵惧埌锛屽氨杩斿洖绌哄€
}
//鍒犻櫎cookie
function removeCookie(name) {
setCookie(name, " 1", -1) //绗簩涓獀alue鍊奸殢渚胯涓€硷紝绗笁涓€艰涓?1琛ㄧず锛氭槰澶╁氨杩囨湡浜嗭紝璧剁揣鍒犻櫎 }
}