2013-07-04 132 views
2

在此網站上Site link我在右上方有一個聯繫信息,電話:鏈接移動設備。我們怎樣才能以最好(最簡單)的方式隱藏桌面上的tel:鏈接? 現在我有這樣的:隱藏電話:桌面上的鏈接

CSS:

#header .contact-info1 { width: 253px; height: 50px; display: block; float: right;  background: url(contact-info1.png) 0 0 no-repeat transparent; margin-right: 39px; margin- top: 110px; } 
#header .contact-info2 { width: 292px; height: 51px; display: block; float: right;  background: url(contact-info2.png) 0 0 no-repeat transparent; margin-right: 0px; margin- top: 30px; } 

@media only screen and (max-device-width: 480px) { 
#header .contact-info1-mobile { width: 253px; height: 50px; display: block; float:  right; cursor: pointer; background: url(contact-info1.png) 0 0 no-repeat transparent;  margin-right: 39px; margin-top: 110px; } 
#header .contact-info2-mobile { width: 292px; height: 51px; display: block; float:  right; cursor: pointer; background: url(contact-info2.png) 0 0 no-repeat transparent;  margin-right: 0px; margin-top: 30px; } 

HTML:

<a href="tel:+491796737741" class="contact-info1-mobile" ></a> 
<div style="clear:right"></div> 
<a href="mailto:[email protected]" class="contact-info2-mobile" ></a> 

目前我隱藏鏈接,臺式機,但我怎麼能隱藏鏈接,臺式機和同時爲桌面顯示聯繫人圖像?

+2

嘿我的SGS3手機在狹窄的720像素的設備寬度(垂直)模式,而SGS4有1080px(垂直)和1920水平。如果您在屏幕像素上檢測到移動設備,它會在很短的時間內變壞。 – FrancescoMM

+0

你可以通過使用'javascript'或'jquery'來實現,請點擊這裏[見](http://stackoverflow.com/a/3540295/1719246) – softsdev

+0

好的,謝謝。有什麼可以推薦使用javascript或jquery實現的鏈接源? –

回答

1

你也可以做到這一點$(window).resize使用jquery

$(window).resize(function() { 
    var width = $(window).width(); 
    if (width < 750) { 
     // Do Something 
    } 
    else { 
     //Do Something Else 
    } 
}); 

另一個選擇通過使用我的評論檢測瀏覽器鏈接提jQuery or javascript