Feature
Post

Category
Code

Custom Reading Containers

For those who have been following Devlounge for a while, you’ll know that I wrote a script called Custom Reading Width. Custom Reading Width allowed users of a particular site to adjust a container’s width. Soon after publishing the article, it was suggested to me that I write something similar that allows a user to drag the edge of a container in order to adjust the container’s width. In an effort to write that script, Custom Reading Containers was born.

In all honesty, I’ve only tested out the script in Firefox 2.0, IE 6, and Opera 9. I should have labeled the script as a beta, but I’m taking Andrew Faulkner’s advice and leaving the beta out of it.

What are the Features?

  1. Custom Reading Containers (CRC) does not rely on any third-party JavaScript library. The script is lightweight and portable.
  2. The script will work on as many containers as your heart desires.
  3. The script saves the width of the container automatically. Custom Reading Width needed user interaction.
  4. CRC is hidden and unobtrusive.
  5. CRC works just as if you were resizing a window.

What are the Applications?

  • CRC can allow users to adjust the reading width in full-width websites.
  • CRC can potentially control containers in a web application.
  • And more…

See the script in action. Demo1 | Demo2

How Does It Work

Custom Reading Containers works by laying a small overlay over the container you wish to resize. As you can see from the image below, the overlay is placed on top of the container.

Devlounge Custom Reading Containers - Container Div with a blue overlay

The overlay’s width and appearance is controlled by CSS. If you like, you can make the overlay transparent, wide, skinny, or whatever style you prefer.

When a user hovers over the overlay, the cursor changes to indicate that the container can be resized.

Devlounge Custom Reading Containers - Container Div with a blue overlay and mouse cursor

The user resizes the container by clicking on the overlay and dragging the mouse to the left or to the right.

Devlounge Custom Reading Containers - Resized Container

Once the user has finished resizing, the script saves the data to a cookie. When the user returns back to the page, a small PHP script calls the cookie and sets the width of the container to the user’s preferred width.

Where Can I Try It Out?

Here are two locations that you can try out. The first location demonstrates how the script reacts to multiple containers. The second example shows how the script will behave when used on a full-width layout.

Where Can I Download it?

Give Custom Reading Containers a try. Download Custom Reading Containers version 1.

Customizing the Script

The test script includes these three files: crc.js, crc.css, and test.php. I will stick to covering them for simplicity.

Make Sure the Container is Relative Positioned

The first thing to note is that any container having the overlay must be relative positioned. This can be accomplished quite simply in CSS by doing: position: relative; in your CSS file.

Modify the crc.js file

You need to modify the crc.js file to include your containers. Towards the bottom of the file, you’ll see code such as this:

var container1 = containerCollection.Add("sidebar", "30%", false, 10, 30, true);

For each container added, give the container a unique variable name such as container1 in this example. There are five things to pass to the containerCollection.Add() function.

  1. The container name. In this example, the container name was “sidebar.”
  2. The default width of the container. My default width for the “sidebar” container was 30 percent. Since the value must be a string, I entered in “30%”. You could have easily have put in “300px”.
  3. Whether the container is fixed or fluid. If the container is fixed, the value should be true. If the container is fluid, the value should be false.
  4. The minimum width of the container. This is an integer value and can be in pixels or percentages.
  5. The maximum width of the container. This is an integer value and can be in pixels or percentages.
  6. Whether the min and max width of the container are in percentages or pixels. If the widths are in percentages, the value is true. Otherwise, the value is false.

You repeat the above steps for each container to be resized.

Insert the PHP Code

The following code must be inserted on any page utilizing Custom Reading Containers. The code is in PHP, so a PHP file is needed to run the script. The PHP script reads in the cookie set by the JavaScript and sets the styles up accordingly. The code needs to be inserted within the head tag.

<?php
	if (isset($_COOKIE["customContainers"])) {
	$ReadingArray = explode(",", $_COOKIE["customContainers"]);
	$ReadingWidth = "";
	for ($i = 0; $i <= sizeof($ReadingArray); $i++) {
		if ($i % 2 == 0) { //if the number is odd
			if (preg_match("/^[-a-zA-Z0-9]+$/", $ReadingArray[$i])) {
				$ReadingWidth .= "\n#" . $ReadingArray[$i] . " {";
			} else { $ReadingWidth .= "\n#ABCDEFGHIJKLMNOPQRSTUVWXYZ {";
			}
		} else {
			if (preg_match("/^\d\d*(px|%)$/", $ReadingArray[$i])) {
				$ReadingWidth .= "width: " . $ReadingArray[$i] . ";}";
			} else {
				$ReadingWidth .= ";}";
			}
		}
	}
	if (sizeof($ReadingArray > 0)) {
?>
<style type="text/css"><?php echo $ReadingWidth ?></style>
<?php }

}
?>

Modify the StyleSheet

The code in crc.css is more-or-less setup to control the overlay. You can easily just paste the overlay code into your existing CSS file. As stated earlier, you can control the overlay’s appearance using your StyleSheet.

.crc-overlay {
	display: block;
	position: absolute;
	right: 0px;
	top: 0;
	width: 5px;
	cursor: e-resize;
	z-index: 100;
	background-color: #000066;
}

Conclusion

Hopefully Custom Reading Containers can help you out, whether it is assisting your users in adjusting the reading width, or perhaps controlling some function of a web application. If you have any feedback or bug reports, please leave a comment.

If you like this script, or would like to show your support, please help out with a Digg.

Feature
Post

Category
Jobs

Phil’s Stock World

Contact Name: Jared Woodard
Email: admin@philstockworld.com
Company Name: Phil’s Stock World
Location: Anywhere
Job Title: Design and Development

Job Description:
Our active investing/trading site needs a redesign to match our move to a professional, subscription-based model.

We also need:

  • the ability to incorporate new authors and/or site sections.
  • an app for updating our online tracking portfolio.

Feature
Post

Category
Homepage News

Fresh Gear

Have you noticed? Today the Devlounge Store officially went live. The purpose? Why to steal all your money of course! Actually with every purchase you’ll be promoting your favorite (or hopefully favorite, top 3, etc) designer and developer resource, and at the same time, you’ll be looking good while you do it! We have a few products right now, ranging from a mousepad to some killer and comical t-shirts (at least we think so). Pick them up if you have a chance, or at least have a look so you can tell your friends what to get you for your birthday!

Feature
Post

Category
Jobs

Senior Internet

Company Name: Senior Internet
Location: Nottingham, UK
Job Title: Development
Job Description: .net Programmer
Job ref: SI-.net

You will be working on a range of medium-sized applications (3-12 month lifecycle) based primarily in the areas of HR, CRM, eCommerce and business process improvement.

An enthusiastic and team player with experience within a development role you will be committed to further your skills and knowledge. Being able to add value and bring intelligent ideas and input to projects is also an important requirement for this role. You will be working with a programming team, project managers and account managers and may have direct contact with clients, so requiring excellent communication skills and confidence.

Skills Needed:
You are likely to be educated to degree level, although relevant commercial experience will be considered. You will be the type of person who has a logical and analytical approach to problem solving as well as eye for detail, good technical design skills and a structured approach to the organisation of information. You will have experience in at least one commercial project of a comparable nature to those that you will be working on. You will have strong skills working with ASP.NET and RDBMS (VB.NET and SQL / MySQL), and have a good knowledge of related skills such as XML, Javascript, CSS and XHTML. You will be motivated and willing to work towards team goals and with a commitment to bringing your best performance to the role.

  • 1 year + asp.NET development experience
  • ASP Programming Experience
  • RDBMS (VB.NET and SQL / MySQL)
  • Experience in HMTL, CSS, JavaScript accessibility related issues
  • Usability concerns
  • Excellent verbal and written communication skills

Please apply using the link below and include some covering notes, a skills matrix table and any relevant web links when applying.

If you believe you have the relevant skills and the right attitude, forward your CV and completed Equal Opportunities Monitoring Form along with your covering letter to andy.faulkner@senior.co.uk.

Feature
Post

Category
Friday Focus

Friday Focus #14

It’s Friday everyone, rejoice! By now you know what that means, a brand spankin’ new edition of Friday Focus. Here’s what was hot over the past week.

Sites of the Week

First up this week is Press-agrum. While we tend not to feature many flash sites in the weekly Friday Focus, I thought the flash here was useful and worked with the site. Now if I could only read it…

Press-agrum

Next up is Jquery, the lightweight javascript library. The new design is tight, and I like it a lot. Loads quickly and does it’s job in explaining what JQ is.

Jquery

Finally there is Superdeluxe. A variety of colors and illustration find themselves splashed onto a backdrop of dark black. The layout isn’t too bad either.

Superdeluxe

Digg Weekly

Design: 53 CSS Techniques you can’t live without
From Smashing Magazine comes a list of 53 css techniques you can’t live without, and guess what number 51 is? Our own Custom Reading Width! That reminds me, have you seen it yet? ;)

Programming: Codefetch – Code Search
Choose a language and search through the source code of thousands of programming books, with links to buy the books as well.

What’s New

The Venice Project has been renamed and will now forever be known as Joost. I happily received my first invite a few days ago, and I’ve loved what I’ve seen so far. Once I have a few invites to pass around, I’ll be offering them here at Devlounge, so watch for them if you want a sneak peak!

Have you submitted yet?

Our first podcast is due in a few days, continue to submit your ideas, as this is a user-driven podcast and the main discussion topics each week will come from your suggestions! Head to the Podcast page to send in your ideas.

Feature
Post

Category
Homepage News

Rolling on 2.1′s

To continue to show our support for the WordPress community, we’ve upgraded Devlounge to the first release RC1 of WordPress 2.1. I’ve gone through and checked pages and feeds and haven’t found any problems, but if you notice anything, please notice us immediately. 2.1 is looking very good and have some great performance improvements, and better yet, it’s due out in a final release next week! Thanks all for now.

Team Devlounge

Feature
Post

Category
General

Essentials: A Healthier Workspace

Essentials Week 1 - Healthier Workspace

Being in the web field, we find ourselves spending countless hours in front of screens and sometimes in boxed up cubicles. Workspaces are like bedrooms for designers and developers a like, sometimes spending even more time in desk chairs than in bed. While this may be routine, there is plenty to consider when setting up a comfortable and healthy workspace.

The Workspace: Ideals and our Practices

The workspace is supposed to be a quiet, comfortable setting for you to focus on work and get it done without distractions. In many cases, workspaces are just the opposite.

If you’re like many, you have papers spread about, pencils and pens laying around, notes here and there, print outs, soda bottles, snacks, cell phones, keys, and anything else you can stuff about in your allocated desk space.

Ideally, you want a clutter free desk with things sorted and structured so for the most part, they can stay out of your way except for when you really need to use them. If that’s already your setup, your about half way there to having a better work environment.

Lighting

Working in the dark might get you imagination up there, but it certainly won’t be helping your eyes a whole lot. It’s never good to be working on computers in dim lighting, just like how it’s not very good to read in minimal light. You don’t want to find yourself squinting, you make sure the workspace is lit up significantly. Try to keep monitors out of the way from windows you so don’t get hit with mean sun-glare or shadows.

Monitor Angle

Are you looking up or down to read this right now? You shouldn’t be. It’s important to have monitors at eye level, so you’re not straining your neck, back, and eyes by looking up or down throughout the day. You want your eyes to be even with the top 1/4 of the monitor. This means if you’re looking up, get a bigger chair or a lower desk.

Refresh Rate

Ever hear of a monitors screen refresh rate? Refresh rates from a variety of levels known as Hertz. If your monitor appears to be “flashing” or “pulsating”, it’s a good idea to try increasing the refresh rate. This can help eliminate eye strain and headaches. To change the refresh rate in windows, right click on the desktop, go down to properties, then head to the settings tab followed by advanced. Depending on your graphics card, you may have a deeper tab structure to go through, but it will be in that general vicinity.

Optimal Desk Setup - Image (C) Dr. Rick Online

Preventing Carpal Tunnel

Carpal Tunnel is something no one wants to get, especially because using keyboards are so important to us. According to Active Ergonomics, the leading cause of carpal tunnel is improper use of the keyboard and mouse, but it can be prevented. Changing the the way you type is one option, and another is moving around! Sitting at a desk for hours on end is never good, so get up and stretch! Grab one of those handy stress balls and do some finger / hand exercises to keep your hands and fingers relaxed and loose. There are some programs out there that will remind you at certain internals when to stop and do some exercises, and they can be extremely helpful in preventing work-related medial problems.

According to the NINDS, the following is how Carpal Tunnel can be prevented.

“At the workplace, workers can do on-the-job conditioning, perform stretching exercises, take frequent rest breaks, wear splints to keep wrists straight, and use correct posture and wrist position. Wearing fingerless gloves can help keep hands warm and flexible. Workstations, tools and tool handles, and tasks can be redesigned to enable the worker’s wrist to maintain a natural position during work. Jobs can be rotated among workers. Employers can develop programs in ergonomics, the process of adapting workplace conditions and job demands to the capabilities of workers. However, research has not conclusively shown that these workplace changes prevent the occurrence of carpal tunnel syndrome.”

Preventing Back Problems: Sit Straight!

The final thing to be aware of is making sure your posture is perfect when working all day long at a desk. Unless you want to be hunched over, sit straight with your back pressed firmly against the back of your chair. While you may feel like just slouching back in a big leather chair after a long day of coding, wait until the days work is done, because getting sloppy for a few hours could have negative effects on your posture.

Evaluate Yourself Further

We’re no doctors, but we do want you to be able to work without putting your body at risk. This excellent 11 step workspace evaluation can help you determine how fit your workspace really is for, well, working. If you have your own tips for a better workspace, feel free to share the knowledge in the comments.

Note: The optimal desk setup image is from Dr. Rick Online, Computer Ergonomics for Kids.

Feature
Post

Category
Homepage News

Podcasts Need You!

Now that the Podcast page is complete and the first edition of the Rundown on the way, we want your input. Each week, most of the rundown topics will come directly from user-submitted topic ideas, giving you the power to ask questions and bring up controversial issues for discussion. Please head over to the podcast page to make a submission!

In other news, the authors index was finally updated. I felt that it had gone un-noticed and unattended, which was not a good thing, especially for all of our hard-working authors. It’s been refreshed and it’s much simpler, with a straight-forward approach for you to get to know the staff that make up this great resource. Be sure to have a look! (and drop us a line if you’d still like to join the team ;) )

Final news today, I had planned to published my first article in a new series that’s going to go on over the next few weeks called Essentials, but I got too tied up working on the other pages today. The article will go live tomorrow, and I can guarantee it will be an important one and one everyone who spends lots of time at a desk will want to read for their own good. Watch for it. I’ll also be making the quick transition to WordPress 2.0.7 tomorrow, and with that Podcasts will be added back into the main feed (as of right now they are not because well, we never really had a true podcast.).

Thanks for reading.
The DL Team

Feature
Post

Category
General

Gravatar is Rising From the Ashes

According to the Gravatar site, Gravatar 2.0 will be released in early February. This is good news to all site owners who have integrated Gravatars into their sites.

Let’s hope Gravatar can make a good comeback. The re-launch will have to be near perfect for people to stick with the struggling service.

Feature
Post

Category
General

Larissa Meek is Featured in Practical Web Design

I was in my local bookstore browsing my favorite magazine — Practical Web Design — when I stumbled upon a familiar name: Larissa Meek.

Devlounge interviewed Larissa Meek in December of ’06 and we’re happy to see her site featured in a great magazine.

If you have January’s issue of Practical Web Design, Larissa Meek is featured towards the back under the “Site Envy” section.

In the UK, the January issue is the last Practical Web Design being published. Its sister magazine — .net magazine — will continue. It is rumored that Practical Web Design will continue in the U.S. as .net magazine re-branded.

Feature
Post

Category
General

WordPress 2.0.7

This month is turning into a busy one for the WordPress team. Just 10 days after releasing 2.0.6, 2.0.7 has been released today with only the slighest changes, most importantly a security fix and a fix for the Feedburner problem that popped up with the release of 2.0.6. This is a highly recommended update, so be sure to grab it from the WordPress Download page. On a sidenote, I’ve been using 2.1 on some other sites / projects and I’ve found it’s very stable, can’t wait for the final release.

Feature
Post

Category
Friday Focus

Friday Focus #13

Now that you’ve improved your WordPress SEO with Ronalfy’s recent and popular SEO plugins post, it’s time to talk about what else was hot this week. I myself have been preoccupied with the upcoming relaunch of the Podcast page (probably tomorrow), so I didn’t get the chance to put together any large articles this week, but maybe some of these sites will put smiles on your faces. So yes, get excited because it’s Friday and this is FF #13.

Sites of the Week

This week starts off with a fresh site I really like. OPUS Underground sports grays, pinks, and purples, and while many might find this to be an odd choice of colors, it works extremely well, and I love the distress touches and background on the site.

Opus Underground

The next site this week is Trig. Trig looks like another social networking site, but the design is somewhat MTV like. Blacks, some flash, and hover effects sum up Trigs design.

Trig

Finally this week is Svenigson, the personal blog of Bence Kucsan. I love the creativity and colors, it’s a very different approach to blogging and the design of a personal blog.

Svenigson

Digg Weekly

Design: From ALA: The Importance of Whitespace
You know how much we hate giving link ups to our “competition”, but this is another great ALA article on the importance of using whitespace in designs, and making sure you’re using the right amount.

Programming: New Free Ruby Book
A new and free Ruby on Rails book, titled the “Humble Little Ruby Book”. I’m not sure how good it is, but it received a hell of a lot of diggs, so it must be pretty good.