Giter Club home page Giter Club logo

schemer's Introduction

JQuery.schemer.js plug-in

For my portfolio site redesign, I wanted to randomly select and display one of several color schemes each time a page was loaded. So I wrote this JQuery script. The script will, given a variable number of string arguments which are CSS class names, choose one at random and attach it to the <html> page element. The styling you defined in your CSS class will then take effect, changing the design scheme for the page.

Along the way, I learned that JQuery's $(document).ready() function only waits until the DOM is complete-- but at that point CSS, images and backgrounds may not be loaded yet. Therefore in my example.html code you'll see that I used $(window).load() to wait until all CSS, images and backgrounds are loaded before changing the scheme.

Example Use

If you have CSS classes .blue, .red and .orange which define your color schemes, you would call the script like this:

$(window).load(
	function() {
            $().schemer("blue", "red", "orange");
	}
);

See example.html for a complete example of how to use the script.

Licensing

This code is licensed under the MIT license.

Written by North Krimsly of www.highintegritydesign.com

schemer's People

Contributors

whatgoodisaroad avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.