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
Post a Comment