Like the question says, is there some way I can go about switching themes in JQuery Mobile dynamically. I just upgraded to beta 1 today and thought it would be cool if the user could pick there own theme if they want. I haven't seen anything in the documentation to do this specifically, but certainly there is some way to go about it, if someone could just point me in the right direction.
The team announced that the cross-platform jQuery Mobile project under its umbrella will be fully deprecated as of October 7, 2021. New technologies for mobile app development have evolved since this project was launched in 2010, so we're encouraging developers to plan for this jQuery Mobile transition.
However, jQuery Mobile is a full framework which is built on jQuery and jQuery UI foundation. It makes use of features of both jQuery and jQueryUI to provide both UI components and API features for building mobile-friendly sites.
jQuery Mobile is a HTML5-based user interface system designed to make responsive web sites and apps that are accessible on all smartphone, tablet and desktop devices. It is built on the rock-solid jQuery and jQuery UI foundation, and offers Ajax navigation with page transitions, touch events, and various widgets.
Hardly sure, but it looks to me like jQuery Mobile's demo has a little theme switcher right inside it. Looks like this is the code that calls it:
$("#someElement").bind("vclick", function() {
$.themeswitcher();
});
You can find the theme switcher's code right here.
Didn't mess around with it, but this sure looks like what you're talking about.
I use a dropdown to allow my users to choose a theme. Here is the code I use for that:
function changeTheme() {
var theme = $("#ddlTheme :selected").val();
var cssUrl = 'css/themes/' + theme + '/jquery-ui-1.8.13.custom.css';
var themeStyle = $("#theme-style");
themeStyle.attr({
rel: "stylesheet",
type: "text/css",
href: cssUrl
});
}
Create a <link>
tag with the id "theme-style". Make it point to your default link.
I use theme roller to create my themes and add them to a sub directory under my css/themes directory named for the theme it represents. I place this value in the dropdown to display to the users.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With