Safari Firefox Chrome You are using Internet Explorer. Have you considered upgrading?
Mar 13th, 2010 by Barker Design
Showcase of Excellent Tables and best practices

Tables are a rather unchallenged interface element. In most cases, they are a forgetten element, an undesired element and a seldom-used element.

 
Mar 13th, 2010 by Barker Design
5 Top jQuery Chart Libraries for Interactive Charts

In this article we are going to present 5 chart libraries that suit different needs from simple charts to high complex charts. Most of them are free for personal and commercial use.

 
Mar 13th, 2010 by Barker Design
How to Map Custom Server File Extensions

Learn how to set up an Apache server to handle custom file extensions.

 
Mar 12th, 2010 by Barker Design
Expression Engine vs WordPress

An excellent article about 2 very popular CMS’s.

 
Mar 11th, 2010 by Barker Design
Book Review: MooTools 1.2 Beginner’s Guide

MooTools Book

In the interest in full disclosure, I was sent this book by Packt Publishing in hopes that I would review it. I’m reviewing this book, however, in the interest of my audience.

Unless you live under a rock or simply check my site for Christina Ricci pics every morning, you know I’m a bit of a MooTools fanboy. I spend hours every day writing MooTools tutorials, getting in touch with the MooTools community and development team members, and oh yeah…coding a bit too. When it was brought to my attention that Jacob Gube and Garrick Cheung had written a MooTools book for beginners, I was really excited to check it out. The following are my thoughts on their book.

The Authors

Jacob Gube, Garrick Cheung

The Tagline

Learn how to create dynamic, interactive, and responsive cross-browser web applications using this popular JavaScript framework.

Shooting From the Hip

Instead of giving you this super long review that you wont read, I’ve decided to put my thoughts into bullet format. How clever!

  • What I really love about this book is that it’s not a bunch of “theory” information — it’s no-nonsense, code-based learning. I LOVE these style of books.
  • The book is ~ 150 pages, which is about right for a beginner’s guide. Making it too long would be a huge mistake.
  • The price point is $40. Reasonable.
  • The book covers a large array of sample projects and code examples — you aren’t looking at the same code snippets everywhere. Awesome.
  • One gripe is that I don’t recall the book ever discussing the difference between MooTools and similar libraries like jQuery, Dojo, etc. MooTools’ object-oriented architecture and the idea of modifying native object prototypes is core to the framework and differentiates MooTools from other libraries. That really should be included in a “version 2″ book.
  • I was not included as a MooTools resource — clearly an oversight. Hahaha.
  • The book *does* cover creating a unique build of MooTools Core and -More. This is very important as beginners should know that MooTools is built to be incredibly modular and Moo programmers should code with that same idea in mind.
  • The book flows very well and the progression of difficulty is perfect. Beginners will really appreciate the pace of the book.
  • While Jacob isn’t a member of the team, he co-authored with contributor Garrick Cheung and asked Christoph Pojer, a MooTools Core Developer, to be technical reviewer. Involving people very close to the team was a great idea; it helps the book’s credibility and allows for all options to be considered. * I don’t mean to say this to discredit Jacob — he’s done a great job with this book and you certainly don’t need to be a team member/contributor to be a MooTools expert.
  • I know it’s Packt’s style, but the “Impact”-style heading fonts are ugly.
  • The book doesn’t try to explain or gloss over basic javascript. Thank you, thank you, thank you!

The Verdict

I was very impressed with this book and I believe it’s the perfect book for any developer looking to enter the MooTools pastures. My only major desire is that the book cover MooTools’ native object prototype modification; beside that oversight, I’d recommend this book to both rookie and novice MooTools developers. MooTools 1.2 Beginner’s Guide should be required reading for MooTools developers looking to master the basic of MooTools.

Don’t forget to follow me on Twitter and be sure to visit Script & Style for the best Javascript and CSS articles around!Sponsor the David Walsh Blog and get your brand in front of several thousand users per day!

Book Review: MooTools 1.2 Beginner’s Guide

Related posts:

  1. Book Review: Enterprise Ajax — Strategies For Building High Performance Web Applications
  2. Book Review: PHP5 CMS Framework Development
  3. Book Review: Wicked Cool PHP
  4. Book Review: Ajax Security
  5. Free SitePoint Ruby on Rails Book!

 
Mar 11th, 2010 by Barker Design
Create Twitter-Style Dropdowns Using MooTools

One of Twitter’s stylish touches is the “Login” dropdown on their homepage. I’ve taken some time to duplicate that functionality with MooTools.

 
Mar 11th, 2010 by Barker Design
Create Twitter-Style Dropdowns Using MooTools

Twitter Dropdown

Twitter does some great stuff with javascript. What I really appreciate about what they do is that there aren’t any epic JS functionalities — they’re all simple touches. One of those simple touches is the “Login” dropdown on their homepage. I’ve taken some time to duplicate that functionality with MooTools.

View Demo

The HTML

<div id="menu1"><div class="relative">
	<a href="/demos" title="Popular MooTools Tutorials" id="dd1" class="dropdown" style="width:170px;text-decoration:none;"><span>Menu 1</span></a>
	<div id="dropdown1" class="dropdown-menu">
		<a href="/about-david-walsh" title="Learn a bit about me.">About Me</a>
		<a href="/page/1" title="The David Walsh Blog">Blog</a>
		<a href="/chat" title="#davidwalshblog IRC Chat">Chat</a>
		<a href="/contact" title="Contact David Walsh">Contact Me</a>
		<a href="/demos" title="CSS, PHP, jQuery, MooTools Demos">Demos &amp; Downloads</a>
		<a href="/js" title="ScrollSpy, Lazyload, Overlay, Context Menu">MooTools Plugins</a>
		<a href="/network" title="David Walsh Blog, Script &amp; Style, Band Website Template, Wynq">Network</a>
		<a href="/web-development-tools" title="JS, CSS Compression">Web Dev Tools</a>
	</div>
</div></div>

<div id="menu2"><div class="relative">
	<a href="/demos" title="Popular MooTools Tutorials" id="dd2" class="dropdown" rel="dropdown2" style="width:170px;text-decoration:none;"><span>Menu 2</span></a>
	<div id="dropdown2" class="dropdown-menu">
		<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
	</div>
</div></div>

A series of DIVS wrapping a link (the dropdown “trigger”) and a DIV containing the menu items.

The CSS

/* dropdowns: general */
a.dropdown { background: #88bbd4; padding: 4px 6px 6px; text-decoration: none; font-weight: bold; color: #fff; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; }
a.dropdown:hover { background: #59b; }
a.dropdown { position: relative; margin-left: 3px; }
a.dropdown span { background-image: url(toggle_down_light.png); background-repeat: no-repeat; background-position: 100% 50%; padding: 4px 16px 6px 0; }
a.dropdown.dropdown-active { color:#59b; background-color:#ddeef6; }
a.dropdown.dropdown-active span { background:url(toggle_up_dark.png) 100% 50% no-repeat; }
.dropdown-menu	{ background:#ddeef6; padding:7px 12px; position:absolute; top:16px; right:0; display:none; z-index:5000; -moz-border-radius-topleft: 5px; -moz-border-radius-bottomleft: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-top-left-radius: 5px; -webkit-border-bottom-left-radius: 5px; -webkit-border-bottom-right-radius: 5px; }
	.dropdown-menu p { font-size:11px; }
.dropdown-menu a:link, .dropdown-menu a:visited	{ font-weight:bold; color:#59b; text-decoration:none; line-height:1.7em; }
.dropdown-menu a:active, .dropdown-menu a:hover { color:#555; }

/* dropdowns: specific */
#menu1			{ float:left; margin-right:20px; }
	#dropdown1	{ width:150px; }
	#dropdown1 a	{ display:block; }
#menu2			{ float:left; }
	#dropdown2	{ width:150px; font-size:11px; }
.relative		{ position:relative; }

There’s a lot of CSS involved but most of it is simple visual styling as opposed to styling for javascript’s sake. Do, however, note where relative and absolute positioning is used. The outermost DIV may be positioned absolutely if you’d like. Also note that I’m not doing anything to accommodate for rounded corners in IE — I recommend DD_Roundies for that.

The MooTools Javascript

window.addEvent('domready',function() {
	(function($) {
		/* for keeping track of what's "open" */
		var activeClass = 'dropdown-active', showingDropdown, showingMenu, showingParent;
		/* hides the current menu */
		var hideMenu = function() {
			if(showingDropdown) {
				showingDropdown.removeClass(activeClass);
				showingMenu.setStyle('display','none');
			}
		};
		/* recurse through dropdown menus */
		$$('.dropdown').each(function(dropdown) {
			/* track elements: menu, parent */
			var menu = dropdown.getNext('div.dropdown-menu'), parent = dropdown.getParent('div');
			/* function that shows THIS menu */
			var showMenu = function() {
				hideMenu();
				showingDropdown = dropdown.addClass('dropdown-active');
				showingMenu = menu.setStyle('display','block');
				showingParent = parent;
			};
			/* function to show menu when clicked */
			dropdown.addEvent('click',function(e) {
				if(e) e.stop();
				showMenu();
			});
			/* function to show menu when someone tabs to the box */
			dropdown.addEvent('focus',function() {
				showMenu();
			});
		});
		/* hide when clicked outside */
		$(document.body).addEvent('click',function(e) {
			if(showingParent && !e.target || !$(e.target).getParents().contains(showingParent)) {
				hideMenu();
			}
		});
	})(document.id);
});

I’ve commented to the code to illustrate what each block does. In a nutshell:

  • I create placeholder variables which will keep track of the current menu, dropdown, and parent for the opened menu. This functionality is only included because I don’t want more than one menu to be open at a time.
  • I create a function that hides the current menu — this can be used from anywhere within the closure.
  • I cycle through each dropdown and add events to relevant elements to show and hide menus.
  • I add an event to the body to close the current menu if the user clicks outside of the menu.

That’s it!

View Demo

Look forward to a MooTools Class version soon. Also look forward to jQuery and Dojo versions!

Don’t forget to follow me on Twitter and be sure to visit Script & Style for the best Javascript and CSS articles around!Sponsor the David Walsh Blog and get your brand in front of several thousand users per day!

Create Twitter-Style Dropdowns Using MooTools

Related posts:

  1. NetTuts Exclusive: Twitter Emulation Using MooTools 1.2 and PHP
  2. David Walsh on NetTuts: Create a Twitter-Like “Load More” Widget
  3. Follow Script & Style on Twitter!
  4. Select Dropdowns, MooTools, and CSS Print
  5. Create Snook-Style Navigation Using MooTools

 
Mar 11th, 2010 by Barker Design
5 Can’t-Miss Usability Tips for Mobile Website Designs

We’re going to cover a few simple, yet prominent steps to designing a much more effective interface and increasing the quality of a mobile websites usability.

 
Mar 11th, 2010 by Barker Design
Best WordPress plugins – February 2010

Today we presents collection of best Wordpress plugins for February 2010.

 
Mar 11th, 2010 by Barker Design
25 Useful CSS3 Techniques and Tutorials

It is essential today for a web designer to know about CSS3 and there are many tutorials and resources for the CSS3. Below i’ve listed 25 Useful CSS3 Techniques and Tutorials to get you started with CSS3, hope you find this collection useful

 

Authors

» Substance: WordPress » Style: Audacity of Tanish