Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Allow my users to switch between set css styles (themes) on my bootstrap site?

Hello I am wondering what the best way to allow my users to switch between different style sheets is.

Basically I want to allow a couple different color schemes and style changes and let the user choose which one they want to display and they can save that one as their default.

I don't imagine this is a difficult task so if somebody wants to explain how I could do it that would be awesome!

My site uses Boostrap as I mentioned in the title.

Nowadays? I'm just here for the nostalgia.
(Feb 8, 2017 05:23 PM)Bluffer Wrote:  Hello I am wondering what the best way to allow my users to switch between different style sheets is.

Basically I want to allow a couple different color schemes and style changes and let the user choose which one they want to display and they can save that one as their default.

I don't imagine this is a difficult task so if somebody wants to explain how I could do it that would be awesome!

My site uses Boostrap as I mentioned in the title.

If I would do this I would first make the different CSS styles or design the different templates

After this you could use a cookie to check which theme (set of styles) he previously used and implement the style the user requested

I would advise using JQuery for this

Here are some tutorials:
  1. http://stackoverflow.com/questions/15992...ith-jquery

  2. https://www.sitepoint.com/eat-those-cook...th-jquery/



Possible other techniques (although Jquery would be the most dynamic one) would be:
  1. PHP and cookies

  2. PHP and MySQL


Public Honeypot Project: https://github.com/Slober3/PotHead
Honeypot Twitter: https://twitter.com/HoneyHive9
BTC: 1Anime1QrjwsEmz8bC2FwVcNXDLxP3SWAJ

Erin Wrote:It’s fine. There’s nothing to be afraid of. Calm down, Lilan
(Feb 9, 2017 06:54 PM)slober Wrote:  If I would do this I would first make the different CSS styles or design the different templates

After this you could use a cookie to check which theme (set of styles) he previously used and implement the style the user requested

I would advise using JQuery for this

Here are some tutorials:
  1. http://stackoverflow.com/questions/15992...ith-jquery

  2. https://www.sitepoint.com/eat-those-cook...th-jquery/



Possible other techniques (although Jquery would be the most dynamic one) would be:
  1. PHP and cookies

  2. PHP and MySQL


[Image: wuqnT5V.jpg]

Wow, thank you!

Nowadays? I'm just here for the nostalgia.
Maybe take a look here http://www.w3schools.com/css/css_intro.asp
They use what your on about here
(Feb 10, 2017 05:54 PM)SIM-2090815 Wrote:  Maybe take a look here http://www.w3schools.com/css/css_intro.asp
They use what your on about here

Thanks for trying but I don't see where I can find the code for that part of the page. Its just an introduction to CSS page which shows that as an example.

Nowadays? I'm just here for the nostalgia.
Anyone else have some ideas?

Nowadays? I'm just here for the nostalgia.
Somebody help me plz lol 😁

Nowadays? I'm just here for the nostalgia.
Slober is correct, you will need JQuery for this.

What the code below does:
- On button click, a function is triggered.
- This function uses JQuery to change your stylesheet.



JQuery is very simple to learn & extremely useful for Front End Design.
If you have any questions please let me know.
(Feb 19, 2017 06:18 PM)SIM-2908357 Wrote:  Slober is correct, you will need JQuery for this.

What the code below does:
- On button click, a function is triggered.
- This function uses JQuery to change your stylesheet.



JQuery is very simple to learn & extremely useful for Front End Design.
If you have any questions please let me know.

Thanks I'll do my best to follow this.

I recently was doing html/css through FreeCodeCamp just for a refresher but didn't like Jquery when it came to that section I'm sure I'll eventually learn it I just would rather get more experience exclusively in html/css before I move onto that.

Appreciate your help though I'll hopefully be able to implement this into my site.

Nowadays? I'm just here for the nostalgia.
(Feb 19, 2017 07:25 PM)Bluffer Wrote:  Thanks I'll do my best to follow this.

I recently was doing html/css through FreeCodeCamp just for a refresher but didn't like Jquery when it came to that section I'm sure I'll eventually learn it I just would rather get more experience exclusively in html/css before I move onto that.

Appreciate your help though I'll hopefully be able to implement this into my site.

Btw, instead of starting a project and learning everything you need for it as you go, you should stop and take a week off to read documentations (js, jquery, bootstrap, css, css3, html5).

It helps a ton just reading over documentations, and attempting to understand them.
The way your learning has frequent roadblocks which can be demotivating and discouraging.

I'm not saying you can't learn that way, I just feel that my advice could work for you because it did for me.

JQuery is also extremely essential if you want to go beyond building static un-responsive pages so you need to learn it.
Is this a simple HTML & CSS page or is there anything powering this?
(Feb 3, 2018 03:19 PM)kickball34 Wrote:  i'm gonna get your ip address and rat your pc.
(Feb 19, 2017 07:55 PM)SIM-2908357 Wrote:  Btw, instead of starting a project and learning everything you need for it as you go, you should stop and take a week off to read documentations (js, jquery, bootstrap, css, css3, html5).

It helps a ton just reading over documentations, and attempting to understand them.
The way your learning has frequent roadblocks which can be demotivating and discouraging.

I'm not saying you can't learn that way, I just feel that my advice could work for you because it did for me.

JQuery is also extremely essential if you want to go beyond building static un-responsive pages so you need to learn it.
Thank you for that, I've been needing some advice like that as I've been finding myself stuck as to where to go next... I feel like the CSS tutorials I've gone through have only taught the main things and not all of CSS as I haven't even learnt about things like FlexBox or web-kit. I'll try reading some documentation but today I've been doing some php on codecademy I would really prefer to work with front-end stuff first though.

(Feb 19, 2017 07:58 PM)grady Wrote:  Is this a simple HTML & CSS page or is there anything powering this?
This website uses Bootstrap.

Nowadays? I'm just here for the nostalgia.
(Feb 19, 2017 10:44 PM)Bluffer Wrote:  This website uses Bootstrap.

For future reference, Bootstrap is just an HTML, CSS, and JS library.
(Feb 3, 2018 03:19 PM)kickball34 Wrote:  i'm gonna get your ip address and rat your pc.
(Feb 19, 2017 11:08 PM)grady Wrote:  For future reference, Bootstrap is just an HTML, CSS, and JS library.

yes thought that is what you were asking 🎉

Nowadays? I'm just here for the nostalgia.
If you want that change to be permanent (or at least for some time) then you will have to save the change in cookie / localstorage. The thing that "Hydroponics" said works, but once the user refreshes the page he will have the old stylesheet.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by RiggsJun 28, 2026 10:00 AM 3 126 Jun 28, 2026 10:00 AM
Last Post: P1N7
by selleck87Feb 11, 2024 05:10 AM 0 131 Feb 11, 2024 05:10 AM
Last Post: selleck87
by DivinityApr 2, 2020 09:05 AM 2 124 Apr 2, 2020 09:05 AM
Last Post: Divinity