I get attached to change the orientation for working with mobile browsers. When the orientation changes, the wrapStat div should change between inline and block display.
This full block of text is replaced for every X seconds by an ajax call, so setting the style to the wrapStat class will not work. I am changing the parent class C # CustomStats between portraitCustomStats and landscapeCustomStats depending on the orientation.
This works in Firefox (resizing the browser will flip the orientation flag), but does not work in any webkit browser until an ajax call comes out.
Is there a problem with webkit and dynamically changing inline and block styles?
CSS
.portraitCustomStats .StatsRow .wrapStat {
display: block !important;
}
.landscapeCustomStats .StatsRow .wrapStat {
display: inline !important;
}
JavaScript:
$(window).bind('orientationchange', function (anOrientationEvent) {
if ($(window).width() > 600) return;
$("#CustomStats").attr("class", anOrientationEvent.orientation.toLowerCase() + "CustomStats").trigger("updatelayout");
});
HTML:
<span id="CustomStats" class="portraitCustomStats">
<tr class="StatsRow">
<td class="description">Unique Visitors</td>
<td class="stat">
<span class="UniqueVisitors">
<strong>
<div class="wrapStat">
<span class="pastStat">(1,318)</span>
<img src="../../Images/up_arr.gif" alt="increase">
<span class="increasedStat">85.43%</span>
</div>
</span>
</td>
</tr>
</span>
Here is the jsFiddle of the code not really working ...
http://jsfiddle.net/Hupperware/43eK8/5/
: http://jsfiddle.net/m/rat/
Firefox ( "" "", , ). FF , ...
Webkit (Safari Chrome) ...