Browse DevX
Sign up for e-mail newsletters from DevX


iPhone Web Development with Ruby on Rails : Page 3






iPhone Orientation in Ruby on Rails


<script> currentWidth = 0; window.setInterval( 'updateLayout()', 200 ); function updateLayout() { if (window.innerWidth != currentWidth) { currentWidth = window.innerWidth; <%= remote_function :controller => 'ifone_controller', :update => 'orientation_div', :url => {:action => :check_position }, :with => 'String(window.innerWidth)' %> } }; </script>



def check_position windowwidth = request.raw_post.chop.to_i if windowwidth > 330 render_text "I seem to be landscape #{windowwidth}" else render_text "I seem to be portrait #{windowwidth}" end end


