问题描述
我正在重新设计一个使用鼠标悬停效果的网站的处理(例如,当您将鼠标悬停在按钮上时,按钮图片会发生变化,当您点击它时,它会转到其他页面)。
I'm the processing of redesigning a website that uses hover effect on a button (like button images changes when you put your mouse over it and when you click it, it goes to a different page).
现在,如果你在台式机/笔记本电脑上工作正常。但在平板电脑上,悬停/ onmouseover效果不工作。在平板电脑上,点击按钮图片时,它会短暂更改,然后立即转到新页面。
Now that works fine if you're on a a desktop/laptop computer. But on a tablet, the hover/onmouseover effect does not work. On a tablet, when clicking the button image, it changes briefly and then immediately goes to a new page.
什么是网站可以检测访问者的方法和技术来自平板电脑还是不是?那么是否可以切换到平板电脑的CSS版本?
What are methods and techniques where a website can detect if a visitor comes from a tablet or not? Then would it be possible to switch to a tablet CSS version? Or, are there tablet framework (i.e. Modernizer?) that can help with this process?
推荐答案
您可以识别iPad(或移动设备)简单地通过检查浏览器的User-Agent参数。
You could identify the iPad (or mobile device) simply by checking the User-Agent parameter of the browser.
在PHP中,您可以执行以下操作:
In PHP for example you could do something like:
if( strstr($_SERVER['HTTP_USER_AGENT'],'iPad') ) { // Add custom iPad CSS }
如果您想进一步了解,可以使用WURFL(http://wurfl.sourceforge.net/)
If you want to get it further you could use WURFL (http://wurfl.sourceforge.net/)
这篇关于在平板电脑(即iPad)上悬停效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!