Jump to content

changing number of columns according to mobile dectection Orientation


avibitton

Recommended Posts

Hi

 

im having trouble in combining php with javascript ,

in short what i need to do if the mobile in 90 degrees(which is wider), so show div with 4 columns ,else(normal orientation) show 3 columns.

i dont know how to use both of javascript orientation detection and php which execute the columns.

 

thats the code which shows the columns :

<?php

  $stmt = $db->query('SELECT * FROM rooms');

  $count = $db->fetchOne( 'SELECT COUNT(name) AS count FROM rooms' );

 

 

    for ( $ro = 0; $ro <$count/4; $ro++ )

{

echo '<div id="rom_wrap">';

for ( $column = 0; $column < 4; $column++ )

{

/*while ($row = $stmt->fetch()) {*/

$row = $stmt->fetch() ;

    echo '<div class="naming" id="naming"><img src="'.$row['image'].'" id="imaging"></br>'.$row['name'].'</div>';

 

}

echo '</div>';

    echo '<br />';

}

   

?>

 

if i wrote that i dont know how to do it so it a quastion :).

i need to know how (?) i can use mobile orientation and according to the orientation, display for example 5 icons to the width of 90 degrees(sided) , and in normal orientatiion to display 4 icons cause it less wide .

 

the display of the icons of course its for loop from the database .

thx avi. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.