The fixed positioned div (The bar with text 'Din Score' and apples in it) is not staying at the bottom of the page. This div class scrollingScoreBoard
is using a javascript where it will stay positioned relative on desktop and laptop view, but will move to fixed position on mobile view.
But, on Samsung Galaxy S and S II, it doesn't stay at the bottom.
How should I keep it fixed at the bottom for these particular phones?
The real working site is here
Comparision between HTC One X and Samsung Galaxy S
So this is what I have:
HTML:
<div id="scrollingScoreBoard">
<div class="currentScoreBox">
<div class="currentScoreText">
<p>Din Score</p>
</div>
<div class="greenAppleContainer">
<img class="appleGreenActive" src="eimg/blankApple.png" alt="" >
<img class="appleGreenDefault" src="eimg/blankApple.png" alt="" >
<img class="appleGreenDefault" src="eimg/blankApple.png" alt="" >
<img class="appleGreenDefault" src="eimg/blankApple.png" alt="" >
<img class="appleGreenDefault" src="eimg/blankApple.png" alt="" >
</div>
</div>
</div>
CSS:
#scrollingScoreBoard{
width: 320px;
color: white;
position: relative !important;
bottom: 0px;
margin:auto;
text-align:center;
left:0;
right:0;
background-color:#163c15;
z-index:1000;
clear:both;
}
.currentScoreBox{
position:relative;
background:url(../eimg/head_bg.png) 0 0 repeat scroll transparent;
height:47px;
width:100%;
max-width:320px;
text-align:left !important;
}
.currentScoreText{
float:left;
padding: 2px 0 0 70px;
}
.currentScoreBox .greenAppleContainer{
float: left;
padding: 12px 0 0 12px;
}
@media screen and (max-width:640px) {
#scrollingScoreBoard{
width: 320px;
color: white;
position: fixed !important;
bottom: 0px;
margin:auto;
text-align:center;
left:0;
right:0;
background-color:#163c15;
z-index:1000;
clear:both;
}
}
@media screen and (max-width:420px) {
#scrollingScoreBoard{
width: 100%;
}
}
JS:
var sticky_offset;
$(document).ready(function() {
var original_position_offset = $('#scrollingScoreBoard').offset();
sticky_offset = original_position_offset.top;
$('#scrollingScoreBoard').css('position', 'relative');
});
$(window).scroll(function () {
var sticky_height = $('#scrollingScoreBoard').outerHeight();
var where_scroll = $(window).scrollTop();
var window_height = $(window).height();
if((where_scroll + window_height) > sticky_offset) {
$('#scrollingScoreBoard').css('position', 'relative');
}
if((where_scroll + window_height) < (sticky_offset + sticky_height)) {
$('#scrollingScoreBoard').css('position', 'fixed');
}
});
$(document).ready(function() {
window.scrollTo(0,1);
});