Mark Forums Read
  #1  
Old 05-11-2011, 05:39 AM
JavaScriptBank JavaScriptBank is offline
Senior Member
 
Join Date: Sep 2009
Posts: 130
JavaScriptBank is on a distinguished road
Default Colours-on-Page Displaying with MooTools

When users click a specified button, this JavaScript code example will get colours of all HTML elements with the predefined color attributes then fill those colours into many tiny rectangles. The auth... detail at JavaScriptBank.com - 2.000+ free JavaScript codes


How to setup

Step 1: Copy & Paste CSS code below in your HEAD section
CSS
Code:
<style type="text/css"> /* This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com */ .dcolor { height:40px; } .dtext { } .dwrapper { width:100px; float:left; padding:10px; margin:0 20px 20px 0; border:1px solid #ccc; } </style>
Step 2: Use JavaScript code below to setup the script
JavaScript
Code:
<script type="text/javascript" src="/javascript/mootools.js"></script> <script type="text/javascript"> // Created by: David Walsh | http://eriwen.com/css/color-palette-with-css-and-moo/ // This script downloaded from www.JavaScriptBank.com //once the dom is ready window.addEvent('domready', function() { //do it! $('get-colors').addEvent('click', function() { //starting the colors array var colors = []; var disallows = ['transparent']; //for every element $$('*').each(function(el) { //record colors! colors.include(el.getStyle('color')); colors.include(el.getStyle('background-color')); el.getStyle('border-color').split(' ').each(function(c) { colors.include(c); }); }); //sort the colors colors.sort(); //empty wrapper $('colors-wrapper').empty(); //for every color... colors.each(function(val,i) { //if it's good if(!disallows.contains(val)) { //create wrapper div var wrapper = new Element('div', { 'class':'dwrapper' }); //create color div, inject var colorer = new Element('div', { 'class':'dcolor', 'style': 'background:' + val }); colorer.inject(wrapper); //alert(val); //create text div, inject var texter = new Element('div', { 'class':'dtext', 'text':val }); texter.inject(wrapper); //inject wrapper wrapper.inject($('colors-wrapper')); } }); }); }); </script>
Step 3: Place HTML below in your BODY section
HTML
Code:
<!-- /* This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com */ --> <input type="button" id="get-colors" value="Get Colors" class="button"> <br><br><br> <div id="colors-wrapper"></div> <br clear="all"> <div style="text-align: left; width: 70%;"> <p> Ma quande lingues coalesce. <span style="color: #279F37;">Li nov lingua franca va esser</span> plu simplic e regulari. Lorem ipsum dolor sit amet, <span style="color: #9F6827;">consectetuer adipiscing elit, sed diam nonummy</span> nibh euismod tincidunt ut <span style="color: #BFB00B;">laoreet dolore magna aliquam erat volutpat</span>.</p> </div>
Step 4: must download files below
Files
mootools.js






Reply With Quote
 #Add to Ads's Reputation  
OldSponsored Ads
Ads AdsPromoter is online
Member
 
Join Date: LongTime
Posts: 1100
Ads is on a distinguished road
Default New Sponsored Ads



This message will go away once you are registered. Also, by registering, you will have access to all post topics, communicate privately with other members (PM), respond to polls, upload graphics, and access other special features! Registration is fast, simple and absolutely free so please Click Here to join our Web Hosting community today!
Reply With Quote
  #2  
Old 06-02-2011, 10:09 PM
zeemar zeemar is offline
Member
 
Join Date: Sep 2010
Posts: 64
zeemar is on a distinguished road
Default

Hello,
Social media is very necessary today it will make you popular and help in promotion. many people do that on many type of social sites. by the way we also provide so many type of seo services.

--------------
Android apps developer
Android apps developers
Android apps developer
Reply With Quote
 #Add to Ads's Reputation  
OldSponsored Ads
Ads AdsPromoter is online
Member
 
Join Date: LongTime
Posts: 1100
Ads is on a distinguished road
Default New Sponsored Ads



This message will go away once you are registered. Also, by registering, you will have access to all post topics, communicate privately with other members (PM), respond to polls, upload graphics, and access other special features! Registration is fast, simple and absolutely free so please Click Here to join our Web Hosting community today!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 06:31 PM.


Powered by vBulletin Version 3.6.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 2.4.0