0
我目前使用cookie來存儲屏幕的寬度,但我想知道每個頁面刷新瀏覽器的寬度。爲瀏覽器寬度設置Cookie
if(!isset($_COOKIE['screenwidth']))
{
return "<script>
if (window.outerWidth) {
document.cookie='screenwidth='+window.outerWidth+'; path=/';location.reload(true);
} else {
document.cookie='screenwidth='+document.documentElement.clientWidth+'; path=/';location.reload(true);
}
</script>";
}
這就是我現在所擁有的。有沒有辦法用jQuery設置寬度?我對此更加熟悉。 另外,我將如何去設置JavaScript的寬度?
你也可以從jQuery中設置cookie .. – 2013-02-20 11:15:40
爲什麼不使用'$(window).width()'? – primetwig 2013-02-20 11:31:30