Switching between Twitter Bootstrap Themes?

后端 未结 4 1041
不思量自难忘°
不思量自难忘° 2021-02-11 03:51

I\'m working on a project for a client built on Twitter Bootstrap. He wants to have different colour schemes that the user can select from. For example have a Red Colour Scheme

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-11 04:22

    Alright, since you want to load different themes...

    You can use jQuery to load different stylesheets

    
        
            
        
        
        ...
    
    

    This could be a button click or another event that is triggered. So, what you would do is simply insert a new element into the head section of the page DOM. This can be done in a couple of lines of jQuery:

    $(document).ready(function () {
        $("a").click(function () {
            $('head').append('');
        });
    });
    

    I hope this solves it...

提交回复
热议问题