index.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. $(document).ready(function () {
  2. window.onresize = function () {
  3. window.location.reload();
  4. };
  5. var slideShow = $(".slideShow"), //获取最外层框架的名称
  6. ul = slideShow.find("ul"),
  7. showNumber = slideShow.find(".showNav span"),//获取按钮
  8. oneWidth = slideShow.find("ul li").eq(0).width(); //获取每个图片的宽度
  9. var timer = null; //定时器返回值,主要用于关闭定时器
  10. var iNow = 0; //iNow为正在展示的图片索引值,当用户打开网页时首先显示第一张图,即索引值为0
  11. showNumber.on("click", function () { //为每个按钮绑定一个点击事件
  12. $(this).addClass("active").siblings().removeClass("active"); //按钮点击时为这个按钮添加高亮状态,并且将其他按钮高亮状态去掉
  13. var index = $(this).index(); //获取哪个按钮被点击,也就是找到被点击按钮的索引值
  14. iNow = index;
  15. ul.animate({
  16. "left": -oneWidth * iNow, //注意此处用到left属性,所以ul的样式里面需要设置position: relative; 让ul左移N个图片大小的宽度,N根据被点击的按钮索引值iNOWx确定
  17. });
  18. });
  19. timer = setInterval(function () { //打开定时器
  20. iNow++; //让图片的索引值次序加1,这样就可以实现顺序轮播图片
  21. if (iNow > showNumber.length - 1) { //当到达最后一张图的时候,让iNow赋值为第一张图的索引值,轮播效果跳转到第一张图重新开始
  22. iNow = 0;
  23. }
  24. showNumber.eq(iNow).trigger("click"); //模拟触发数字按钮的click
  25. }, 5000); //2000为轮播的时间
  26. $(".container_nav a").click(function (e) {
  27. e.preventDefault();
  28. $(this).addClass("selected");
  29. $(this).siblings().removeClass("selected");
  30. var c = $(this).html();
  31. // alert(a);
  32. if (c == "跟单") {
  33. $(".nav_contain>div:first-child").addClass("active");
  34. $(".nav_contain>div:not(:first-child)").removeClass("active");
  35. } else if (c == "工艺") {
  36. $(".nav_contain div:nth-child(2)").addClass("active");
  37. $(".nav_contain div:not(:nth-child(2))").removeClass("active");
  38. } else if (c == "质检") {
  39. $(".nav_contain div:nth-child(3)").addClass("active");
  40. $(".nav_contain div:not(:nth-child(3))").removeClass("active");
  41. } else if (c == "加工") {
  42. $(".nav_contain div:nth-child(4)").addClass("active");
  43. $(".nav_contain div:not(:nth-child(4))").removeClass("active");
  44. } else if (c == "物流") {
  45. $(".nav_contain div:nth-child(5)").addClass("active");
  46. $(".nav_contain div:not(:nth-child(5))").removeClass("active");
  47. }
  48. });
  49. //中英文之间的转化
  50. $("#eng").click(function () {
  51. $(".footer_title p:first-child").html("Fujian Shengteng Knltting Textlle Co.,Ltd.");
  52. $(".footer_top li:first-child").html("Contacts:LINXUEGUI (General Manager)");
  53. $(".footer_top li:nth-child(2)").html("Tel:+86 0591-28761238");
  54. $(".footer_top li:nth-child(3)").html("Mobile:13599097555");
  55. $(".footer_top li:last-child").html("Fax:+86 0591-28761296");
  56. $(".footer_bottom li:first-child").html("E-mail:fjshengteng@163.com");
  57. $(".footer_bottom li:last-child").html("Add:shenjutengda,Songxia Town,Changle City,Fujian Province,China");
  58. $(this).css("background", "#5E97F5");
  59. $("#chn").css("background", "transparent");
  60. });
  61. $("#chn").click(function () {
  62. $(".footer_title p:first-child").html("福建升腾针纺有限公司");
  63. $(".footer_top li:first-child").html("联系人:林雪贵(总经理)");
  64. $(".footer_top li:nth-child(2)").html("手机号码:13599097555");
  65. $(".footer_top li:nth-child(3)").html("电话:0591-28761238");
  66. $(".footer_top li:last-child").html("传真:0591-28761296");
  67. $(".footer_bottom li:first-child").html("邮箱:fjshengteng@163.com");
  68. $(".footer_bottom li:last-child").html("公司地址:福建省长乐市松下镇龙纺工业区");
  69. $(this).css("background", "#5E97F5");
  70. $("#eng").css("background", "transparent");
  71. });
  72. $(".swiper-slide").mouseover(function () {
  73. //放大图片
  74. $(this).css({"transform": "scale(1.1)", "transition": "all .2s linear"});
  75. }).mouseout(function () {
  76. //恢复正常
  77. $(this).css({"transform": "scale(1)", "transition": "all .2s linear"});
  78. });
  79. var swiper = new Swiper('.swiper-container', {
  80. slidesPerView: 4.6,
  81. spaceBetween: 30,
  82. pagination: {
  83. el: '.swiper-pagination',
  84. clickable: true,
  85. },
  86. });
  87. });