Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When using jQuery Mobile, how do I handle styling when JavaScript is disabled?

I'm playing with jQuery Mobile (1.1.0 RC1) because it basically does all the work of making my website look nice on mobile devices.

What am I supposed to do if javascript is disabled? I'm still new to HTML5, but my understanding is that the styling is based on the data-* attributes and without jQuery being able to read which theme/role it needs, no styling can be applied.

I can't find a default stylesheet that I can just apply, and the Theme Roller doesn't give a base swatch. Does jQuery Mobile have any kind of fallback for this, or do I need to write a custom set of stylesheets myself?

like image 985
Brandon Avatar asked Feb 29 '12 17:02

Brandon


People also ask

Do people still use jQuery Mobile?

“According to Builtwith, of the top 10,000 websites about 88% (or close to 9,000) of them are currently using jQuery as of the beginning of 2019.” jQuery is a well-tested library with a large community of developers who continue to contribute time and effort to modernize and improve the library.

What is the use of jQuery Mobile?

The framework allows developers to build applications that can be accessed by the widest number of browsers and devices, whether it is Internet Explorer 6 or the newest Android or iPhone. Mobile jQuery also gives developers the ability to render basic content (as built) on basic devices.


1 Answers

jQuery Mobile only really works well on browsers that support jQuery. Otherwise, the grading system kicks in and your app will degrade. Consider applying a custom stylesheet in a <noscripts> tag for those users.

<noscript>
<link rel="stylesheet" href="your-non-jqm-css.css" />
</noscript> 

Example: http://www.w3schools.com/tags/tag_noscript.asp

like image 163
shanabus Avatar answered Sep 27 '22 17:09

shanabus