ruby on rails - Rendering Partials with Slim -


current slim.html:

#fullpage   =render partial: 'section_one'   =render partial: 'section_two'   =render partial: 'section_three'   =render partial: 'section_four'   =render partial: 'section_five' 

the issue i'm having don't want render partial: 'section_four' being viewed on mobile.

i tried this:

#fullpage   =render partial: 'section_one'   =render partial: 'section_two'   =render partial: 'section_three'   - if $(window).width() >= 700     =render partial: 'section_four'   =render partial: 'section_five' 

but doesn't work. ideas?

try use request.user_agent recognize mobile device. should use inline if condition while checking mobile device:

= render partial: 'section_four' if request.user_agent =~ /mobile|webos/ 

there can cases request.user_agent =~ /mobile|webos/ fail return expected results due browser's custom user_agent.

so, recommend mobile-fu work in better way.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -