Demand, a link PC is customer service, mobile is the phone number;
Idea 1: If a link is a page only one, write two sets. Do the show and hide it.
Idea 2: If a link has a lot of pages, is the promotion page, only a set of code to implement the PC and mobile, this method is now more appropriate.
Idea 3: If the fixed section. such as corporate websites, and mobile pages. It's better to separate the layout.
1 Get object, click. Determine the width of the PC's screen, and add a phone number less than 900.
Add a customer service link if it is greater than 900;
<script type= "Text/javascript" >
$ (". A_tel"). Click (function () {
var w = document.documentElement.scrollWidth | | Document.body.scrollWidth;
if (w<900) {
$ (this). attr ("href", "tel:400-9696-898");
}else{
$ (this). attr ("href", "http://www41.53kf.com/webCompany.php?kf_sign=jkzMDMTUzMExNjEwNTUwMzkzMzY1MDAy&arg= 10101905&style=1 ");
}
})
Judging Mobile and PC
if (Navigator.userAgent.match (/(phone|pad|pod|iphone|ipod|ios|ipad| android| mobile| blackberry| iemobile| mqqbrowser| juc| fennec|wosbrowser| Browserng| webos| symbian| Windows Phone))) {
Alert (' Mobile side ')
}else{
Alert (' PC side ')
}
</script>
Change the URL of a link