现在有一段时间我正在努力在我的控制器中测试一个简单的 if 语句。
if (screen.width <= 768) {
$location.hash('map');
$anchorScroll();
}
Run Code Online (Sandbox Code Playgroud)
我找到了一种用不同大小生成浏览器的方法,但它不起作用,screen.width总是保持不变。有没有办法覆盖那部分代码?