Php 滚动到脚本不适用于响应站点

Php 滚动到脚本不适用于响应站点,php,jquery,html,css,Php,Jquery,Html,Css,好的,我正在设计我公司的新网站。我在页面顶部有一个固定的导航,带有使用jQuery滚动到网页所需部分的链接。我的问题是,当您将浏览器的大小重新调整为iPhone/Smartphone大小时,用于滚动的脚本将无法工作。我无法判断我使用的WordPress主题是否引起冲突,或者CSS是否有干扰。我已经在控制台中测试了脚本调用功能,它可以工作,但是页面没有滚动到各个部分 该网站是

好的,我正在设计我公司的新网站。我在页面顶部有一个固定的导航,带有使用
jQuery
滚动到网页所需部分的链接。我的问题是,当您将浏览器的大小重新调整为iPhone/Smartphone大小时,用于滚动的脚本将无法工作。我无法判断我使用的WordPress主题是否引起冲突,或者CSS是否有干扰。我已经在控制台中测试了脚本调用功能,它可以工作,但是页面没有滚动到各个部分

该网站是<我意识到讽刺

这是我用来调用滚动脚本的代码

jQuery('li.menu-item a').click(function (e) {
    event.preventDefault();

    jQuery('li.current_page_item').removeClass('current_page_item');
    jQuery(this).parent().addClass('current_page_item');

    console.log('clicked ' + this);
    console.log('clicked ' + e.currentTarget.hash);
    var target = e.currentTarget.hash;
    jQuery(target).ScrollTo({
        duration: 1000,
        easing: 'swing'
    });
});
这是滚动脚本

 /*
     * @depends jquery
     * @name jquery.scrollto
     * @package jquery-scrollto {@link http://balupton.com/projects/jquery-scrollto}
     */

/**
 * jQuery Aliaser
 */
(function(window,undefined){
    // Prepare
    var jQuery, $, ScrollTo;
    jQuery = $ = window.jQuery;

    /**
 * jQuery ScrollTo (balupton edition)
 * @version 1.2.0
 * @date July 9, 2012
 * @since 0.1.0, August 27, 2010
 * @package jquery-scrollto {@link http://balupton.com/projects/jquery-scrollto}
 * @author Benjamin "balupton" Lupton {@link http://balupton.com}
 * @copyright (c) 2010 Benjamin Arthur Lupton {@link http://balupton.com}
 * @license MIT License {@link http://creativecommons.org/licenses/MIT/}
 */
ScrollTo = $.ScrollTo = $.ScrollTo || {
    /**
     * The Default Configuration
     */
    config: {
        duration: 400,
        easing: 'swing',
        callback: undefined,
        durationMode: 'each',
        offsetTop: 0,
        offsetLeft: 0
    },

    /**
     * Configure ScrollTo
     */
    configure: function(options){
        // Apply Options to Config
        $.extend(ScrollTo.config, options||{});

        // Chain
        return this;
    },

    /**
     * Perform the Scroll Animation for the Collections
     * We use $inline here, so we can determine the actual offset start for each overflow:scroll item
     * Each collection is for each overflow:scroll item
     */
    scroll: function(collections, config){
        // Prepare
        var collection, $container, container, $target, $inline, position,
            containerScrollTop, containerScrollLeft,
            containerScrollTopEnd, containerScrollLeftEnd,
            startOffsetTop, targetOffsetTop, targetOffsetTopAdjusted,
            startOffsetLeft, targetOffsetLeft, targetOffsetLeftAdjusted,
            scrollOptions,
            callback;

        // Determine the Scroll
        collection = collections.pop();
        $container = collection.$container;
        container = $container.get(0);
        $target = collection.$target;

        // Prepare the Inline Element of the Container
        $inline = $('<span/>').css({
            'position': 'absolute',
            'top': '0px',
            'left': '0px'
        });
        position = $container.css('position');

        // Insert the Inline Element of the Container
        $container.css('position','relative');
        $inline.appendTo($container);

        // Determine the top offset
        startOffsetTop = $inline.offset().top;
        targetOffsetTop = $target.offset().top;
        targetOffsetTopAdjusted = targetOffsetTop - startOffsetTop - parseInt(config.offsetTop,10);

        // Determine the left offset
        startOffsetLeft = $inline.offset().left;
        targetOffsetLeft = $target.offset().left;
        targetOffsetLeftAdjusted = targetOffsetLeft - startOffsetLeft - parseInt(config.offsetLeft,10);

        // Determine current scroll positions
        containerScrollTop = container.scrollTop;
        containerScrollLeft = container.scrollLeft;

        // Reset the Inline Element of the Container
        $inline.remove();
        $container.css('position',position);

        // Prepare the scroll options
        scrollOptions = {};

        // Prepare the callback
        callback = function(event){
            // Check
            if ( collections.length === 0 ) {
                // Callback
                if ( typeof config.callback === 'function' ) {
                    config.callback.apply(this,[event]);
                }
            }
            else {
                // Recurse
                ScrollTo.scroll(collections,config);
            }
            // Return true
            return true;
        };

        // Handle if we only want to scroll if we are outside the viewport
        if ( config.onlyIfOutside ) {
            // Determine current scroll positions
            containerScrollTopEnd = containerScrollTop + $container.height();
            containerScrollLeftEnd = containerScrollLeft + $container.width();

            // Check if we are in the range of the visible area of the container
            if ( containerScrollTop < targetOffsetTopAdjusted && targetOffsetTopAdjusted < containerScrollTopEnd ) {
                targetOffsetTopAdjusted = containerScrollTop;
            }
            if ( containerScrollLeft < targetOffsetLeftAdjusted && targetOffsetLeftAdjusted < containerScrollLeftEnd ) {
                targetOffsetLeftAdjusted = containerScrollLeft;
            }
        }

        // Determine the scroll options
        if ( targetOffsetTopAdjusted !== containerScrollTop ) {
            scrollOptions.scrollTop = targetOffsetTopAdjusted;
        }
        if ( targetOffsetLeftAdjusted !== containerScrollLeft ) {
            scrollOptions.scrollLeft = targetOffsetLeftAdjusted;
        }

        // Perform the scroll
        if ( $.browser.safari && container === document.body ) {
            window.scrollTo(scrollOptions.scrollLeft, scrollOptions.scrollTop);
            callback();
        }
        else if ( scrollOptions.scrollTop || scrollOptions.scrollLeft ) {
            $container.animate(scrollOptions, config.duration, config.easing, callback);
        }
        else {
            callback();
        }

        // Return true
        return true;
    },

    /**
     * ScrollTo the Element using the Options
     */
    fn: function(options){
        // Prepare
        var collections, config, $container, container;
        collections = [];

        // Prepare
        var $target = $(this);
        if ( $target.length === 0 ) {
            // Chain
            return this;
        }

        // Handle Options
        config = $.extend({},ScrollTo.config,options);

        // Fetch
        $container = $target.parent();
        container = $container.get(0);

        // Cycle through the containers
        while ( ($container.length === 1) && (container !== document.body) && (container !== document) ) {
            // Check Container for scroll differences
            var scrollTop, scrollLeft;
            scrollTop = $container.css('overflow-y') !== 'visible' && container.scrollHeight !== container.clientHeight;
            scrollLeft =  $container.css('overflow-x') !== 'visible' && container.scrollWidth !== container.clientWidth;
            if ( scrollTop || scrollLeft ) {
                // Push the Collection
                collections.push({
                    '$container': $container,
                    '$target': $target
                });
                // Update the Target
                $target = $container;
            }
            // Update the Container
            $container = $container.parent();
            container = $container.get(0);
        }

        // Add the final collection
        collections.push({
            '$container': $(
                ($.browser.msie || $.browser.mozilla) ? 'html' : 'body'
            ),
            '$target': $target
        });

        // Adjust the Config
        if ( config.durationMode === 'all' ) {
            config.duration /= collections.length;
        }

        // Handle
        ScrollTo.scroll(collections,config);

        // Chain
        return this;
    }
};

// Apply our jQuery Prototype Function
$.fn.ScrollTo = $.ScrollTo.fn;

})(window);
/*
*@jquery
*@name jquery.scrollto
*@package jquery滚动到{@linkhttp://balupton.com/projects/jquery-scrollto}
*/
/**
*jQuery别名器
*/
(函数(窗口,未定义){
//预备
var jQuery,$,ScrollTo;
jQuery=$=window.jQuery;
/**
*jQuery ScrollTo(巴卢普顿版)
*@version 1.2.0
*@日期2012年7月9日
*@自2010年8月27日0.1.0起
*@package jquery滚动到{@linkhttp://balupton.com/projects/jquery-scrollto}
*@作者Benjamin“balupton”Lupton{@linkhttp://balupton.com}
*@copyright(c)2010本杰明·阿瑟·卢普顿{@linkhttp://balupton.com}
*@license-MIT-license{@linkhttp://creativecommons.org/licenses/MIT/}
*/
ScrollTo=$。ScrollTo=$。ScrollTo | |{
/**
*默认配置
*/
配置:{
持续时间:400,
放松:"摇摆",,
回调:未定义,
durationMode:'每个',
偏移量:0,
offsetLeft:0
},
/**
*配置ScrollTo
*/
配置:功能(选项){
//将选项应用于配置
$.extend(ScrollTo.config,选项|{});
//链子
归还这个;
},
/**
*对集合执行滚动动画
*我们在这里使用$inline,因此可以确定每个overflow:scroll项的实际偏移量开始
*每个集合针对每个溢出:滚动项
*/
滚动:功能(集合、配置){
//预备
变量集合、$container、container、$target、$inline、position、,
集装箱CrollTop,集装箱CrollLeft,
集装箱CrollTopEnd,集装箱CrollLeftEnd,
STARTOFSETTOP、TARGETOFSETTOP、TARGETOFSETTOP已调整,
startOffsetLeft、targetOffsetLeft、targetOffsetLeftAdjusted、,
滚动选项,
回调;
//确定滚动条
collection=collections.pop();
$container=集合。$container;
container=$container.get(0);
$target=集合。$target;
//准备容器的内联元素
$inline=$('').css({
'位置':'绝对',
“顶部”:“0px”,
“左”:“0px”
});
position=$container.css('position');
//插入容器的内联元素
$container.css('position','relative');
$inline.appendTo($container);
//确定顶部偏移量
startOffsetTop=$inline.offset().top;
targetOffsetTop=$target.offset().top;
targetOffsetTopAdjusted=targetOffsetTop-startOffsetTop-parseInt(config.offsetTop,10);
//确定左偏移量
startOffsetLeft=$inline.offset().left;
targetOffsetLeft=$target.offset().left;
targetOffsetLeftAdjusted=targetOffsetLeft-startOffsetLeft-parseInt(config.offsetLeft,10);
//确定当前滚动位置
containerScrollTop=container.scrollTop;
containerScrollLeft=container.scrollLeft;
//重置容器的内联元素
$inline.remove();
$container.css('position',position);
//准备滚动选项
滚动选项={};
//准备回拨
回调=函数(事件){
//检查
如果(collections.length==0){
//回拨
if(typeof config.callback==='function'){
apply(此[event]);
}
}
否则{
//重现
ScrollTo.scroll(集合,配置);
}
//返回真值
返回true;
};
//如果我们只想在视口外滚动,请处理
如果(仅限config.onlyfoutside){
//确定当前滚动位置
containerScrollTopEnd=containerScrollTop+$container.height();
containerScrollLeftEnd=containerScrollLeft+$container.width();
//检查我们是否在容器可见区域的范围内
if(容器CrollTopjQuery('li.menu-item a').click(function (e) {
    e.preventDefault();

    jQuery('li.current_page_item').removeClass('current_page_item');
    jQuery(this).parent().addClass('current_page_item');

    console.log('clicked ' + this);
    console.log('clicked ' + e.currentTarget.hash);
    var target = e.currentTarget.hash;
    jQuery(target).ScrollTo({
        duration: 1000,
        easing: 'swing'
    });
});
$('li.menu-item a').click(function (e) {
    e.preventDefault();

    $('li.current_page_item').removeClass('current_page_item');
    $(this).parent().addClass('current_page_item');

    console.log('clicked ' + this);
    console.log('clicked ' + e.currentTarget.hash);

    $(e.currentTarget.hash).ScrollTo({
        duration: 1000,
        easing: 'swing'
    });
});