分享10个关于web移动开发的实用原生JavaScript代码
这段时间用惯了jquery就很少写原生JavaScript代码,今天整理了10个实用的移动开发方面的js脚本分享给大家,希望对大家有帮助 。
?
31、原生JavaScript判断是否移动设备
37、原生JavaScript判断是否打开视窗
40、原生JavaScript获取移动设备屏幕宽度function getScreenWidth(){var smallerSide = Math.min(screen.width, screen.height);var fixViewPortsExperiment = rendererModel.runningExperiments.FixViewport || rendererModel.runningExperiments.fixviewport;var fixViewPortsExperimentRunning = fixViewPortsExperiment && (fixViewPortsExperiment.toLowerCase() === "new");if(fixViewPortsExperiment){if(this.isAndroidMobileDevice() && !this.isNewChromeOnAndroid()){smallerSide = smallerSide/window.devicePixelRatio;}}return smallerSide;}?
?