8932_10180_backup.jsp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <script src="/main/dist/website/template/BNr02DHL36iU/plug-in/swiper@5.3.7/js/swiper.min.js"></script>
  2. <script src="/main/dist/website/template/BNr02DHL36iU/plug-in/js/jquery1.11.3.min.js"></script>
  3. <script>
  4. // 轮播
  5. var swiper = new Swiper('.swiper-container', {
  6. spaceBetween: 30,
  7. effect: 'fade',
  8. loop: true,
  9. autoplay:true, //自动切换
  10. pagination: {
  11. el: '.swiper-pagination',
  12. clickable: true,
  13. },
  14. navigation: {
  15. nextEl: '.swiper-button-next',
  16. prevEl: '.swiper-button-prev',
  17. },
  18. });
  19. // 滚动跳转导航高度
  20. $(window).scroll(function() {
  21. if($(window).scrollTop() >= 30){
  22. $('.nav').css({
  23. "height": "50px",
  24. "line-height": "50px"
  25. });
  26. $(".nav-placeholder").css("height","50px");
  27. $(".nav-list").css("top","50px");
  28. }else{
  29. $('.nav').css({
  30. "height": "80px",
  31. "line-height": "80px"
  32. });
  33. $(".nav-placeholder").css("height","80px");
  34. $(".nav-list").css("top","80px");
  35. }
  36. });
  37. window.onload = function () {
  38. var imgHeight = $(".swiper-container").height();
  39. $(".banner").height(imgHeight);
  40. // 搜索
  41. $(".search-icon").click(function(){
  42. $(".search-wrap").slideDown(100);
  43. $(".search-wrap input").focus();
  44. })
  45. // 关闭搜索
  46. $(".search-close").click(function(){
  47. $(".search-wrap").slideUp(100);
  48. })
  49. // 搜索输入
  50. $(".search-wrap input").bind("input",function(){
  51. if($(this).val().length != 0){
  52. $(".search-wrap button").show();
  53. $(".search-wrap .search-close").hide();
  54. }else{
  55. $(".search-wrap button").hide();
  56. $(".search-wrap .search-close").show();
  57. }
  58. })
  59. // 移动端导航
  60. $(".nav-icon").click(function(){
  61. if($(".nav-list").css("display") == "none"){
  62. $(".nav-list").slideDown(200);
  63. }else{
  64. $(".nav-list").slideUp(200);
  65. }
  66. })
  67. }
  68. window.onresize = function () {
  69. var imgHeight = $(".swiper-container").height();
  70. $(".banner").height(imgHeight);
  71. }
  72. </script>