javascript - How to override responsive features in Twitter Bootstrap 2? -
i have site using twitter bootstrap , using of responsive features. works fine on desktop , mobile devices. shrinking window on desktop cause responsive grid kick in, , responsive grid served mobile device appropriately.
however, possible iphone user access 'non-responsive' version? it's safe iphone , android phones access 'full' version of sites, i'd offer option mobile users.
back before 'responsive' hottest thing, typically handled via client browser detection , backend routed clients 2 different sites, pages, or themes render content, , there kind of link or button afforded user allow them visit full-site instead. i'm trying replicate usage pattern.
if don't want reload page after change "desktop" version try disable repsonsive stylesheet(s). see: removing or replacing stylesheet (a <link>) javascript/jquery , https://stackoverflow.com/a/15824131/1596547. removing stylesheet seems work.
some proof of concept removing responsive stylesheet:
css:
<link href="bootstrap-responsive.css" rel="stylesheet" id="responsivecss">
javascript:
var responsivecss = true; $('#switch').click( function () { if(responsivecss) { $('#responsivecss').remove(); $(this).text('mobile version'); responsivecss = false; } else { $('head').append('<link href="bootstrap-responsive.css" rel="stylesheet" id="responsivecss">'); $(this).text('desktop version'); responsivecss = true; } } );
try it: http://plnkr.co/ldouquuypmnood5urbtz
twitter's bootstrap 3
tb3 don't have separate responsive css file. same have create css file without responsive features (see: http://bassjobsen.weblogs.fm/compile-twitters-bootstrap-3-without-responsive-features/) switch these files on click.
Comments
Post a Comment