Giter VIP home page Giter VIP logo

rainbow.js's Introduction

Rainbow.js

A jQuery library to manage gadients easily !

#Get started Its easy, you have to download the rainbow.js main script, once its done, you just have to link it to your documents, after the jQuery inclusion.

<script type="text/javascript" src="path/to/jQuery.min.js"></script>
<script type="text/javascript" src="path/to/rainbow.min.js"></script>

#Create your first gradient !

Let's start with a simple structure. We will create a regular shape, a square.`

First, the css

.square{ 
	width:4em; 
	height:4em; 
	margin:.5em;
 }

And the HTML :

<div 
	class="square rainbow" 
	id="gradient_2" 
	data-type="linear" 
	data-degrees="45" 
	data-color="f1c40f-d35400" 
	data-opacity="1" 
></div>

#Result :

#Gradient Headers : You can add some sexy gradients to your header images. For example, the header image of the rainbow.js demo website use this function, so if we look at the code, we can see :

HTML :

<div 
	class="rainbow" 
	id="rainHeader_1" 
	data-type="linear" 
	data-degrees="45" 
	data-color="f1c40f-e74c3c" 
	data-opacity=".75" 

	role="header"> 
	<div class="content header">
		<h1>Rainbow.js</h1>
        <h2>A small jQuery gradient helper.</h2>
    </div>
</div>

The image was declared on the stylesheet :

CSS:

//I use the role attribute. But assume it works with any kind of targetting. ID / Classes / attributes.
[role="header"] {
    background: url(path/to/my/image.jpg) no-repeat center center;
    background-size: cover;
    height: 15em;
    text-align: center;
}

#Result :

#Gradient images :

This is one of the coolest Rainbow.js feature ! Its still in developement because we encounter issues with the gradient images on resize, but be sure it'll be fixed soon on a future release.

By the way, you can still use it and play with it, but we didn't recommend to use it for production websites.

CSS :

.image{ 
	width:15em; 
	height:8em; 
	display:block; 
	margin:auto; 
	background:url(path/to/image.png)no-repeat center center; 
	background-size:cover; 
}

HTML :

<div 
	class="image rainbow" 
	id="gradient_80" 
	data-type="linear" 
	data-degrees="45" 
	data-color="000-F00" 
></div>

Result :

#Gradient texts :

And finally, the last feature, a cool one, but unfortunately -webkit-only. If you're not a webkit browser user, you will get a gradient background behind your texts.

We don't know yet if we should remove the function if you're not on a webkit browser, or display something else instad.

HTML :

<h1 
	class="rainbow" 
	id="rainText_1" 
	data-type="linear" 
	data-degrees="0" 
	data-color="000-F00" 
>Look ma ! A Rainbow text !</h1>

Result :

Bugs

Functions :

  • Gradient headers
  • Gradient images
    • If image got an elastic width, the gradient don't fit properly on resize.
  • Gradient blocks
  • Gradient Text
    • Webkit only

rainbow.js's People

Contributors

dervondenbergen avatar lukyvj avatar

Watchers

 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.