scripting for smartphones or tabletts or desktops only
A Pen by Alexander Schmidt on CodePen.
<div id="smartphone">Smartphone</div> | |
<div id="tablett">Tablett</div> | |
<div id="desktop">Desktop</div> |
scripting for smartphones or tabletts or desktops only
A Pen by Alexander Schmidt on CodePen.
$( document ).ready(function() { | |
var is_smartphone = false; | |
var is_tablett = false; | |
var is_desktop = false; | |
if( $('#smartphone').css('display')=='block') { | |
is_smartphone = true; | |
} | |
if( $('#tablett').css('display')=='block') { | |
is_tablett = true; | |
} | |
if( $('#desktop').css('display')=='block') { | |
is_desktop = true; | |
} | |
if (is_smartphone == true) { | |
// your script here | |
} | |
if (is_tablett == true) { | |
// your script here | |
} | |
if (is_desktop == true) { | |
// your script here | |
} | |
}); |
#smartphone { | |
display: block; | |
} | |
#tablett { | |
display: none; | |
} | |
#desktop { | |
display: none; | |
} | |
@media screen and (min-width: 768px) { | |
#smartphone { | |
display: none; | |
} | |
#tablett { | |
display: block; | |
} | |
#desktop { | |
display: none; | |
} | |
} | |
@media screen and (min-width: 992px) { | |
#smartphone { | |
display: none; | |
} | |
#tablett { | |
display: none; | |
} | |
#desktop { | |
display: block; | |
} | |
} |