视口不是.js中的函数错误

时间:2018-08-09 21:34:44

标签: javascript function

我是javascript的新手,出现以下错误“ Uncaught TypeError:视口不是一个功能scripts.min.js:279”,并且我不知道如何解决。知道有什么问题吗? 谢谢。

var lastScrollTop = 0;
    function smartSidebars() {	  //<==== line 279
    	var width = viewport().width;
    	var st = jQuery(window).scrollTop();
    	//see which direction we're going	
    	if (st > lastScrollTop){
    		var direction = 'down';
    	} else {
    		var direction = 'up';
    	}
    	affixObject(jQuery('.post-left'), jQuery('.post-right'), direction, false);	
    	if(width > 991) {
    		affixObject(jQuery('.loop-sidebar-left'), jQuery('.main-post-container'), direction, true);
    		affixObject(jQuery('.loop-sidebar-right'), jQuery('.main-post-container'), direction, true);
    		affixObject(jQuery('.single-sidebar'), jQuery('.post-right'), direction, true);
    	} else {
    		moveLoop();
    	}
    	lastScrollTop = st;		
    }


//-----------------------------------------------------------


function viewport() {
    var e = window, a = 'inner';
    if (!('innerWidth' in window )) {
        a = 'client';
        e = document.documentElement || document.body;
    }
    return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
}

0 个答案:

没有答案