2013年6月24日 星期一

Change Themes of jQuery UI in MVC 4 template

Remond theme as the example

image

 

Go to below URL:

http://jqueryui.com/themeroller/

Click Gallery to see pre-defined theme templates, choose one that you like and click Download button

image

Choose the latest stable version

image

 

Give it a name as Folder Name and click Download

image

 

Unzip the downloaded file and extract to any temp folder

image

 

Inside the folder, drill-down to css folder

image

 

Inside css folder, there is redmond folder which is what we will be using, copy the entire redmond folder

image

 

Paste into Visual Studio project folder under ~\Content\themes\

image

 

In BundleConfig.cs, add a bundle item

image

bundles.Add(new StyleBundle("~/Content/themes/redmond/css").Include(
            "~/Content/themes/redmond/jquery-ui-{version}.custom.css"));


In Create.cshtml, add this bundle style sheet

image

@Styles.Render("~/Content/themes/redmond/css")

 

Compile and run the application, we will see the color changes:

Datepicker before & after:

imageimage

 

Dialog & Tabs, before & after:

image

image

 

[Important Note]

Actually, the Tabs won’t work correctly without adding following style sheet definition in css file

image

Don’t forget to add the same code in .min.css file

image

The code is able to be copied from standard jquery.ui.tabs.css file in base folder

image

.ui-tabs .ui-tabs-hide { display: none !important; }

沒有留言:

張貼留言