if ($(window).width() >= 992) {
var swiper2 = new Swiper("#swiper2", {
slidesPerView: 3,
spaceBetween: 30,
navigation: {
nextEl: '#product_next',
prevEl: '#product_prev',
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
});
} else {
var swiper2 = new Swiper("#swiper2", {
slidesPerView: 2,
spaceBetween: 15,
pagination: {
el: ".swiper-pagination",
clickable: true,
},
});
}
$(".el").on("click", function () {
if ($(this).hasClass("s--active")) return;
$(".cont").addClass("s--el-active");
$(this).addClass("s--active")
});
$(".el__close-btn").on("click", function (e) {
e.stopPropagation();
$(".cont").removeClass("s--el-active");
$('.el.s--active').removeClass('s--active');
});
var el_style = "";
$.each($(".cont__inner .el"), function (i, v) {
el_style += ".el:nth-child(" + (i + 1) + ") .el__bg:before { background-image: url('" + $(this).find(".el__bg").attr("data-img") + "') }"
});
$("").appendTo('head');
if ($(window).width() >= 1200) {
var scroll_height = 400;
} else {
var scroll_height = 240;
}
$(window).scroll(function () {
if ($(document).scrollTop() <= scroll_height) {
$(".top_menu.fixed").removeClass("fadeInDown");
$(".top_menu.fixed").addClass("fadeOutUp");
$(".cont").addClass("s--inactive")
} else {
$(".top_menu.fixed").removeClass("hide fadeOutUp");
$(".top_menu.fixed").addClass("fadeInDown");
$(".cont").removeClass("s--inactive")
}
});
$("#company_content .company_img").insertAfter($("#company_content p:eq(0)"));
$("#company_content .company_icon").insertBefore($("#company_content p:eq(-2)"));
$(".subcompany_box .expand").on('click', function () {
if ($(this).parent('.subcompany_box').hasClass('active') == true) {
$(this).find('span').html('expand');
$(this).parent('.subcompany_box').removeClass('active');
} else {
$(this).find('span').html('retract');
$(this).parent('.subcompany_box').addClass('active');
}
});
if ($("#service_page").val() == 1) {
$('#map').vectorMap({
map: 'world_mill_en', // 世界地图
backgroundColor: 'transparent',
zoomMin: 0.9, // 鼠标缩放时的最小比例
zoomMax: 5, // 鼠标缩放时的最大比例
focusOn: {
x: 0.55,
y: 2,
scale: 0.9
},
regionStyle: {
initial: {
fill: '#999', // 地图颜色
"fill-opacity": 1,
stroke: 'none',
"stroke-width": 0,
"stroke-opacity": 1,
},
hover: {
fill: '#008fd7', // 鼠标滑动至某省份的高亮颜色。
"fill-opacity": 1
},
selected: {
fill: 'yellow'
},
selectedHover: {}
},
markerStyle: {
initial: {
fill: '#015eac', // 足迹位置的填充颜色
stroke: '#fff', // 足迹位置的描边颜色
r: 5,
},
hover: {
fill: '#015eac', // 鼠标滑动至足迹位置后的填充颜色
stroke: '#fff', // 鼠标滑动至足迹位置后的描边颜色
"fill-opacity": 0.8
},
},
markers: [
{ latLng: [5.18, 102.05], name: 'Malaysia' },
{ latLng: [-4.32, 119.86], name: 'Indonesia' },
{ latLng: [20.59, 78.96], name: 'India' },
{ latLng: [40.01, 54.63], name: 'Turkmenistan' },
{ latLng: [32.42, 53.68], name: 'Iran' },
{ latLng: [51.16, 10.45], name: 'Germany' },
{ latLng: [56.13, -106.34], name: 'Canada' },
{ latLng: [39.78, -101.36], name: 'America' },
{ latLng: [-8.82, -53.93], name: 'Brazil' },
{ latLng: [26.10, -104.17], name: 'Mexico' },
{ latLng: [-1.39, -78.43], name: 'Ecuador' },
{ latLng: [1.35, 103.81], name: 'Singapore' },
{ latLng: [21.56, 95.57], name: 'Myanmar' },
{ latLng: [41.37, 64.58], name: 'Uzbekistan' },
{ latLng: [41.57, 72.89], name: 'Kyrgyzstan' },
{ latLng: [29.97, 69.38], name: 'Pakistan' },
{ latLng: [33.06, 42.99], name: 'Iraq' },
{ latLng: [61.52, 105.31], name: 'Russia' },
{ latLng: [54.68, -2.32], name: 'United Kingdom' },
{ latLng: [52.13, 5.29], name: 'Netherlands' },
{ latLng: [49.81, 15.47], name: 'Czech Rep.' },
{ latLng: [28.16, 2.55], name: 'Algeria' },
{ latLng: [26.58, 29.87], name: 'Egypt' },
{ latLng: [15.45, 18.73], name: 'Chad' },
]
});
};
$("#message_submit").on("click", function () {
if ($("#name").val() != "" && $("#phone").val() != "" && $("#email").val() != "" && $("#message").val() != "") {
$(".input_box").removeClass("error");
$.ajax({
type: "POST",
dataType: "json",
url: 'https://www.china-cfft.com/index.php?s=form&c=liuyan&m=post',
data: $("#myform").serialize(),
success: function () {
mdui.dialog({
content: ' Thank you for your message, we will get back to you as soon as possible!',
buttons: [{ text: 'Close' }]
});
},
error: function () {
mdui.dialog({
content: ' Sorry, something went wrong. Please refresh the page and try again!',
buttons: [{ text: 'Close' }]
});
}
})
} else {
if ($("#name").val() == "") {
$("#name").parent().addClass("error");
} else {
$("#name").parent().removeClass("error");
}
if ($("#phone").val() == "") {
$("#phone").parent().addClass("error");
} else {
$("#phone").parent().removeClass("error");
}
// if ($("#qq").val() == "") {
// $("#qq").parent().addClass("error");
// } else {
// $("#qq").parent().removeClass("error");
// }
if ($("#email").val() == "") {
$("#email").parent().addClass("error");
} else {
$("#email").parent().removeClass("error");
}
if ($("#message").val() == "") {
$("#message").parent().addClass("error");
} else {
$("#message").parent().removeClass("error");
}
}
});