the following JS does work, somehow, but i have a sense that something is inherently wrong with the condition. could you pls help me sort it out?
Here's the simple html. I want the age distinction (adult vs child) to be out of the screen when it can not contain too many elements.
Code:
<div align="center">
<select data-role="slider">
<option value="off" >man</option>
<option value="on"> woman</option>
</select>
</div></td>
<td> <div class="bigga" align="center">
<select data-role="slider" >
<option value="off">adult</option>
<option value="on"> child</option>
</select>
and here is the unelegant js:
Code:
$(document).ready(function() {
if ((screen.width>=240) )
{
$('.bigga').hide();
}
if ((screen.width>=320) )
{
$('.bigga').show();
}
});
First of all, all the trick should be doable with just one condition. By logic, this condition should look as follows:
Code:
$(document).ready(function() {
if ((screen.width<=240) )
{
$('.bigga').hide();
}
});
This would mean that when the screen width is 240 or smaller, the "bigga" clas of elements does not show up.
Why does it not work?...