>
> Hey I DIG that text size thingie you've got on that site.
> When you have some time I'd love to hear how you did that.
It's actually pretty simplistic. This site gets a lot of traffic on New
Years so the goal is improve performance. The method I used performs
better, but is a pain to maintain.
The basic decision code is just this:
<!--- Set the Style Sheet to use --->
<cfset PossibleStyles = "Small,Medium,Large,Larger,Largest">
<cfif IsDefined("URL.TextStyle") AND
ListFind(PossibleStyles,URL.TextStyle)>
<cfcookie name="TextStyle" value="#URL.TextStyle#"
expires="NEVER">
</cfif>
<cfif IsDefined("Cookie.TextStyle")>
<cfset Request.TextStyle = Cookie.TextStyle>
<cfelse>
<cfset Request.TextStyle = "Medium">
</cfif>
It defaults to "Medium" if there's no cookie and uses cookies to set a
different prference. This code is a "Wrapper" custom tag (every page is
wrapped in the wrapper) but it could also be the Application.cfm).
For each style in "PossibleStyles" there's a different style sheet. The
sheet is linked like this:
<link rel="stylesheet" type="text/css"
href="/Assets/Styles/Standard_<cfoutput>#Request.TextStyle#</cfoutput>.c
ss" title="Standard">
The links to change the style just pass that URL variable (TextStyle).
This way there's not much processing, but any change to the style sheet
must be made five times. Another option is to make your style sheet a
CFM page - that way you could programmactically set relative sizes. But
then you're running more code on the page (you could also work up a
system to cache the styles or create static files or something... It was
easier for me just to edit five sheets).
Our designer came up with the design of the buttons and I'm pretty proud
of that. Most of the sites I've seen with this kind of functionality
have a drop down list or a list of font sizes. With the graphical scale
(I think) it's very clear both what the control will do and what each
button does.
The major problem with this is that it's too simplistic really: only the
body changes, not the menus or graphical elements. I think it might
help some folks, but it's not completely accessible.
Jim Davis
Jim Davis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm