Username:

Password:

Author Topic: CSS Tricks: Banner Code Displayer Thing  (Read 256 times)

siteFEEDS

  • Administrator
  • Hero Member
  • *****
  • Karma: +1/-0
  • Posts: 1994
CSS Tricks: Banner Code Displayer Thing
« on: August 03, 2009, 06:07:12 AM »
Banner Code Displayer Thing
3 August 2009, 3:45 am

Authentic Jobs is a long-running, respected, and successful web design/development job board. I’m sure a lot of that success is due to the beautiful, minimal, and thoughtful design by owner and proprietor Cameron Moll. There is also a generous affiliate program, the screens for which share the thoughtful UI of the rest of the site. Take a look below at the screen for approved affiliates:



I thought this was a clever way to handle delivering graphics and code snippets to users who may not be HTML nerds, but likely know enough to copy and paste. This is the screen I’ll being doing a demo for, using jQuery for the functionality.

 

View Demo   Download Example

 

When creating the affiliate program for Are My Sites Up, I wanted to offer essentially the same thing: Copy-and-Paste code and a choice of hosted graphics. I borrowed heavily from the Authentic Jobs system. So for this example I’ll combine the functionality I wrote for the AMSU system with styling similar to the Authentic Jobs page.

Schematics



Functionality:

Three major elements: Size Selector, Code Box, Example Area

Default is 125×125 graphic, with code and example to match

When new selection is chosen from the Size Selector, the Code Box and Example Area dynamically update to show the new code and new example.

The HTML Markup

We should stop and think a little bit about what actually “changes” when a new selection is chosen from the dropdown. The code changes, but the only thing that changes is the file name of the graphic chosen. Then the “example” area is literally exactly the same as the code, only it’s real code that we need to render, not show in a textarea. So the only information we need to dynamically update both these areas is the file name. Let’s be smart then, and include this valuable information in the markup associated with each
Logged