Simply use this:
$(window).height();
Read here
Вопрос
I have form page in HTML5
.
The page is too much big so I added a scroll: jquery.nicescroll
I wrapped the form with <div>
and set a iPhone 4 height:480px
and run the niceScroll
constructor function.
<div id = "scroller">
<form>
..
...
......
</form>
</div>
<script>
$('#scroller').niceScroll();
</script>
It works fine, but the issue is that I should give to each device his own height : (height-40px) so it will look nice on device. For example: for Iphone4 height:480px, for iPhone5: 568px,Samsung S2 533 etc.
What is the best way to check the height value of device so I can use it after that?
Now I can check the device company with userAgent
:
navigator.userAgent.indexOf("iPhone")
But I need to know exactly the model
Решение 2
Другие советы
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}
/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}
/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}
/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}
/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}
/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}
/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}
/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}
Please set the multipal device height in this code.