Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am a freelancer and i am doing a website using asp.net c#.Can any one tell me how to make a division
in html visible only in desktop.God bless you.
Posted
Updated 12-Dec-13 18:55pm
v2
Comments
Mitchell J. 13-Dec-13 0:53am    
What sort of division? A <div>? A <br />?
faizel s 13-Dec-13 0:55am    
<div>
BillWoodruff 13-Dec-13 1:25am    
div tags affect what is displayed in a browser: what's that got to do with the Desktop ?
faizel s 13-Dec-13 1:36am    
By Desktop i mean laptop browsers
What have you tried and where is the problem?

1 solution

There are many ways to detect, using javascript, whether a browser is mobile or not.
It's easier to detect a mobile browser - and thus indirectly desktop browsers - because if a browser is not mobile, it's desktop.

Check this link out. There are heaps of free code samples on the web.

Once you have a javascript function to detect whether a browser is mobile or not, you can then run some javascript on DOM load to hide the div with the background image.

Forexample, using jQuery:
JavaScript
$(document).ready(function () {
   //You can find heaps of functions that you can rename "isMobileBrowser()" through the link above.
   if (isMobileBrowser()) {
      //change bk_image to whatever the id of your div is.
      $('bk_image').css('display', 'none');
   }
});

Hope this helps :-)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900