123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- $(window).scroll(function() {
- if($(this).scrollTop() > $('header').offset().top) {
- $('header').addClass('nav_fx')
- }
- if($(this).scrollTop() == 0) {
- $('header').removeClass('nav_fx')
- }
- })
- var getSize = function() {
- var client_w=document.documentElement.clientWidth
- console.log(client_w)
- if(client_w>1000){
- document.body.style.fontSize=12+'px'
- }
- if(client_w>=750&&client_w<1000){
- document.body.style.fontSize=10+'px'
- }
- if(client_w<750&&client_w>=650){
- document.body.style.fontSize=8+'px'
- }
- if(client_w<650&&client_w>=400){
- document.body.style.fontSize=6+'px'
- }
- if(client_w<400&&client_w>=360){
- document.body.style.fontSize=5+'px'
-
- }
- if(client_w<360){
- document.body.style.fontSize=4+'px'
- }
- document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
- }
- window.onload=function(){
- getSize();
- }
- $(document).ready(function() {
- getSize();
- $(window).resize(function() {
- getSize();
- });
- })
- $(function() {
- var mySwiper = new Swiper('.swiper-container', {
- loop:true,
- pagination: {
- el: '.swiper-pagination',
- clickable: true
- },
- autoplay:{
- delay:2000,
- stopOnLastSlide:false,
- disableOnInteraction:true
- }
- })
- });
- $(document).ready(function() {
- //加载时隐藏子菜单
- $('li ul').hide();
- //不包含子菜单时鼠标指针和项目图标
- $('li:not(:has(ul))')
- .css({
- 'cursor': 'default'
- });
- //包含子菜单时鼠标指针和项目图标
- $('li:has(ul)')
- .css({
- 'cursor': 'pointer'
- });
- //单击含子菜单的项
- $('li:has(ul)').children('p').click(function(event) {
- if(this == event.target) {
- if($(this).siblings('ul').is(':hidden')) {
- $(this)
- .siblings('ul').show();
- $(this).children('span').text('-')
- } else {
- $(this)
- .siblings('ul').hide();
- $(this).children('span').text('+')
- }
- }
- })
- $('#rtTop').click(function(e) {
- e.preventDefault();
- $('html ,body').animate({
- scrollTop: 0
- }, 300);
- })
- })
- $('.bar_content').click(function() {
- if($('.bar_content').hasClass('active')) {
- $('.bar_content').removeClass('active')
- }
- })
- $('.icon_left').click(function() {
- $('.bar_content').toggleClass('active')
- $('body,html').toggleClass('ovfHiden')
- })
|