'Website Design' Category Results

jQuery Enlightenment Review

Thursday, January 14th, 2010

jQuery Enlightenment

Over the past month I have been reading jQuery Enlightenment by Cody Lindley. Let me say now, that if you use jQuery or are thinking about using jQuery then you should most certainly buy this book. It’s a quick read (122 pages) that includes colorized code samples, easy to follow examples and solid explanations.

Author Cody Lindley is a member of the jQuery team and explains why he wrote the book.

jQuery Enlightenment was written to express, in short-order, the concepts essential to intermediate and advanced jQuery development. Its purpose is to instill in you, the reader, practices that jQuery developers take as common knowledge. Each chapter contains concepts essential to becoming a seasoned jQuery developer.

This book is intended for three types of readers. The first is someone who has read introductory books on jQuery and is looking for the next logical step. The second type of reader is a JavaScript developer, already versed in another library, now trying to quickly learn jQuery. The third reader is myself, the author. I crafted this book to be used as my own personal reference point for jQuery concepts. This is exactly the type of book I wish every JavaScript library had available.

I would argue that this book is perfectly suitable for beginners too. It’s simply a must have jQuery book. It’s the only one you need; it will take you from beginner to competent user.

I do ASP.NET / C# web development where I build web-based software for school districts. My preferred architecture is one in which I use NO server-controls. That means no GridViews, no Repeaters, no ListViews. If fact, nothing that uses runat server will be found on the page. The page will only consist of XHTML. So there is no need for a viewstate either. We end up using jQuery a lot in this architecture. We use jQuery / Ajax to call Web services that then query the database using LINQ to SQL and pass our data back to the client where we can then populate our XHTML controls. It works great and is extremely fast and efficient. The code couldn’t be cleaner. In addition, this methodology would allow you to easily change to a PHP or Java backend and you wouldn’t have to change a single thing on the frontend. I will give a full example on this methodology another time, but the point is – you need to learn jQuery.

For more information on the jQuery Enlightenment book, including a breakdown of each chapter go here. I would recommend buying the full color book from lulu.com as it’s well designed and very handy to have on your desk.

CSS – A Sticky Subject

Friday, October 9th, 2009

CSS is a sticky subject in the best of times and to make it more sticky I thought I’d run down the techniques needed to make a sticky footer that works in all modern browsers. This is unlike most examples on the web that break in either Opera, IE8, IE7 or indeed in all three.

Try any of those footers from the Google search above in IE8 or Opera (some don’t work in IE7 either). Load the page then grab the bottom of the window (not the side or corner of the window) and drag it up or down and you will see that the footer usually sticks in the wrong place, messing up the display.

Now try it on my old original sticky footer version (circa 2003 which pre-dates all those above) and you will see that my version is working in all browsers including IE8.

Before we get into details I should first explain what a sticky footer is.

What is a Sticky Footer

A sticky footer is one that sits at the bottom of the viewport when there is not enough content in the page to push the footer down. If there is a lot of content then the footer sits at the bottom of the document and will be below the fold as usual. Why this is desirable is because on short content pages you won’t have a footer right at the top of the screen looking very strange indeed as shown from Figure 1 below.

Figure 1 – normal footer close to content.
Normal footer

Figure 2 – Sticky footer at bottom of viewport.
f2

Note that a “fixed positioned” footer is not the same thing as a sticky footer as a fixed positioned footer is one that sits at the bottom of the viewport at all times and never moves. Don’t get confused between the two.

Overview

Before we get into the nitty gritty detail I will briefly explain the concept in getting a sticky footer to work.

The first thing we need to do is create a 100% high container which is achieved by setting the html and body elements to 100% height and then creating a container that is a minimum of 100% high. The footer is then placed after this container which means it will be invisible as it will be below the fold of the page but by the magic of negative margins we can bring it back into view at the bottom of the viewport.

Of course this means that the sticky footer must be a fixed height (pixels or ems will do) so that we know how to accommodate it with the exact negative margins that bring it into view. This also means that our footer is now overlapping content on the page so we will also need to protect this content with either padding on an inner element, or some other similar approach as you will see when we get into specifics later.

That’s basically all there is to it except that we have to squash a few bugs on the way to make it work everywhere.

(more…)

Lijit’s Integration with WordPress

Monday, November 3rd, 2008

lijit.png

I spoke to you back in January about Lijit. Remember I showed you that Lijit allows you to easily create your own search engine. One that searches your blog, bookmarks, photos, blogroll, and more.

I really liked Lijit then but I was disappointed that I couldn’t integrate the Lijit search functionality into WordPress. That is let Lijit take over my search box that was already there and is ALREADY there in just about every other blog too. Instead you had to put a widget on your page. I felt like this was such a mistake I actually went to visit Lijit in Boulder and told them so. Well I’m happy to say that they have listened and now allow you to let their search take over your search box. Here’s what they say:

Lijit’s integration with WordPress.org just keeps getting better! Now you can either install the Lijit Search widget OR have Lijit power your existing WordPress search box. As if that weren’t exciting enough, our Lijit stats will automatically display within your WordPress dashboard for one-stop stats viewing too.

Go ahead and have a look, try the search located in the top left corner….

If you like it you can find the Lijit WordPress plugin here.

My Favorite Geek Books of 2008

Wednesday, October 1st, 2008

The above photo is my stack of geek books from last Christmas. Yes, I love books — I love the way they smell, thumbing through the pages and oh yes, the wisdom they bestow. I admit, often times I don’t make it through the entire book. Sometimes just a handful of chapters. But every now and then you come across some great books that are gems. So I thought I would share a few of my favorite books from this year.

Head First C#

Head First C#

Each morning before work I stop and enjoy a latte or cappuccino. This is my book of choice to read while sipping down my caffeine kick-start. That’s because it’s not like your typical code book which can be pretty dry. This book is very visual, full of pictures and diagrams that help to illustrate and drive home key points. Often times it finishes the chapter with a crossword puzzle helping you to retain the points of the chapter. In fact those crossword puzzles inspired this post. It’s a great read for beginners and advanced users alike.

Object-Oriented ActionScript 3.0

Object-Oriented ActionScript 3.0

If you are just starting to learn Flash or Flex or ActionScript then this is the book for you. Actually, even if you are a seasoned pro this is still the book for you. Why? Because it teaches you the correct way to do things. It teaches you true object oriented programming in ActionScript. With topics like: Encapsulation, Classes, Inheritance, Polymorphism, Interfaces, and Design Patterns you will not only learn ActionScript, but also principles of OOP. If you wish to learn proper Flash/Flex development then this book is for you.

The ASP.NET Anthology

The ASP.NET Anthology

This book takes a problem solving approach to a handful of common everyday ASP.NET developer needs. Things like: form validation, membership and access control, working with email, rendering binary content, Ajax, handling errors and more. Sitepoint says this about the book, which I agree with: “Solve specific ASP.NET problems fast — without wading through mountains of reference material — and rest assured your code follows current best practices. For the serious ASP.NET coder, this book is a must-have.”

The Ultimate CSS Reference

The Ultimate CSS Reference

Perhaps the last CSS book you’ll ever need. Written by our very own Paul O’Brien whom regulars to Search-This will know does an amazing job making sense of often tricky, finicky or strange CSS behaviors. Almost every web site created today is built using CSS, which is why a thorough knowledge of this technology is mandatory for every web designer. There are plenty of good resources to help you learn the basics, but if you’re ready to truly master the intricacies of CSS, this is the book you need.

ASP.NET 3.5 Unleashed

ASP.NET 3.5 Unleashed

Make no mistake about it, this is a reference book at almost 2,000 pages. But it may be the best ASP.NET reference book on the market. It covers everything: LINQ to SQL, ASP.NET AJAX, ListView and DataPager data access controls and all the rest. What’s especially nice is that you can tell the author, Stephen Walther, has spent time in the trenches. He knows best practices, like using CSS for all his layout work and having well-formed cross-browser friendly code all the while teaching you ASP.NET 3.5. This is a must-have book for all ASP.NET developers.

Well there you have it, five of my favorite geek books of 2008. Do you have a book that you read this year that you thought was a gem?

IDing the Problem of ASP.NET

Wednesday, August 20th, 2008

I love ASP.NET, but one thing I find extremely frustrating is dealing with the automatically generated ID properties that it places on page elements.

For example, let's say you have a div with an id of "contentTop" like below:

HTML:
  1. <div id="contentTop" runat="server">...</div>

Because you have made the control a server-side control by adding the runat="server" attribute it will now be rendered with a different ID when it hits the browser (view the source code and you will see). It will get rendered as something like this:

HTML:
  1. <div id="ctl00_contentTop">...</div>

This is because ASP.NET generates its own IDs to ensure that every element on the page has a unique ID. Developers that work with JavaScript and CSS will immediately see the problem. This causes difficulty when using JavaScript and CSS which rely on those IDs to reference elements, as they can't easily predict what the generated ID will be. When it comes to CSS specificity the ID selector is extremely useful. In addition, anyone that uses JavaScript knows that getElementById (or one of the JavaScript library ways) is the most popular way to target an element. So why the hell does ASP.NET do this to us? Honestly, I can't really tell why, other than the fact that they must not trust us enough to be able to uniquely ID our elements ourselves.

But I don't want to just complain here, I would like to provide some solutions too.

Solution

The solution will be found in the ClientID property of the server-side control. The ClientID property represents the ID that ASP.NET will use for the element on the client.

Using the ScriptManager we place the ClientID in a hidden form field. This can all be done in the code-behind file by using the following code:

C#:
  1. ScriptManager.RegisterHiddenField(this, "contentTop", contentTop.ClientID);

Be sure to have included the ScriptManager to your page, like so:

ASP:
  1. <asp:ScriptManager ID="ScriptManager1" runat="server">
  2.     </asp:ScriptManager>

Now we can use JavaScript to retrieve the value from our hidden form fields.

JAVASCRIPT:
  1. var id = form1.contentTop.value;
  2. var cTop = document.getElementById('id');

That's it, if you know of another way, please let us know.
Happy coding.

My CSS is Cat -(Categories With CSS)

Wednesday, August 13th, 2008

This article details how to produce a product category list with associated images and text. This is the sort of thing you would see if you did a search on Amazon.

I am going to start by showing the finished product as this will help you visualize what we are going to achieve along the way. Figure 1 below shows a smaller version of the task ahead.

Figure 1

We are going to make a similar display but without using tables as in my view the information presented is not tabular and does not have a logical correspondence between rows and columns. Even if you do present a good case of why this should be in a table, please don't comment on this as we are interested in the layout techniques rather than perfect semantics (for this example). The techniques presented here can be used in other layouts that are certainly not tabular and will prove useful in many situations.

(more...)

How Good Are You at JavaScript and CSS?

Monday, June 30th, 2008

This year I have found myself looking for jobs on two separate occasions. As a result I have had a good number of interviews. One question that I found harder to answer than I had anticipated was when asked how good I am at JavaScript and CSS.

Why was this question that hard to answer? I actually feel that I am quite knowledgeable about both CSS and JavaScript. I've built probably close to a dozen websites using entirely CSS-based layouts over the last few years. In addition, I have used JavaScript quite often to enhance those websites, usually with Ajax and spiffy web widgets like the Comment Info Tip Plugin. I may not be as knowledgeable as Paul O'Brien when it comes to CSS or Jonathan Snook when it comes to JavaScript, but I certainly am competent. So again, what's the problem?

The problem is the damn cross-browser problems that still trip a person up from time to time. Almost every time I ask Paul for his help with CSS it has to do with a cross-browser issue: something works in Firefox, but not in IE or vice versa. Same with JavaScript; think addEventListener method in Firefox and attachEvent for Internet Explorer. This is a bloody mess for the developer and I suppose makes me question my abilities at times.

Such cross-browser issues make it hard for a developer. I don't know about you, but I've often spent more time trying to make a site work across all browsers than on the actual design of the site.

There are people that I know and respect that have chosen not to learn JavaScript at all because they were so put off by such difficulties. Also consider how difficult it's been to get people to leave HTML table-based designs behind in favor of CSS layouts. It's been slow at best. No doubt due much to the differences across browsers.

What's your take? How has the difficulties in trying to achieve all browser support effected your attitude of CSS and JavaScipt?

Popular Articles

Top 10 Commentators


Subscribe to this feed! Subscribe by Email!

Random Bits Podcast

You need to download the Flash player from Adobe

Blogs Worth Reading