Sitemast left cornerFeature articlesBasic guidesAdvanced guidesWeb Standards CompliancyContact pageLinks and moreNews ChannelSite logo

General

Lightweight Rollovers

A reoccurring question, especially when code-oriented stuff is discussed at the 24h FreewayForum, is “how do I insert this or that code bit in Freeway?” The answer is as simple as it is visible. There’s a button. It looks like this: Extend button image and it appears in a number of places throughout the Freeway interface. There’s also an Extend feature in the Item menu and in the Page menu. So: there are many ways of easily extending the powers of Freeway.

What Is It Good For?

Let’s look at a common example, an HTML rollover. Say that you have a table with some cells containing text links and that you want the whole cell to change colour when pointed at with a mouse —not just the link text. So how do we do that? With the Extended... button. Like this:

Draw a table on a page. Make it 2 columns by 1 row, any size you like. Set cell spacing, cell margin and border values to zero (0) in the Inspector. When you have created the table, click once on one of the cells to select it and then look at the Inspector. You will see two Extend buttons in the Cell tab. Click on the topmost one. This will bring up a dialogue window. Click the New button to open the code editor.

Step 2 is to enter a Name, which defines the type of declaration you’re doing. Type style.

Next, add the following code snippet in the Value field:
background-color: #CACACA;

Now, click OK to confirm the style you just created. Then click New again to make a new declaration, this time call it onMouseover (which is a Javascript event handler). Then in the value field, type the following code:
this.style.backgroundColor='#FFFF00'; style.cursor='pointer'
Note that the single quotes around the colour name are necessary for this to work. Click OK to confirm.

Finally we’re going to reset the rollover with another Javascript event, onMouseout. Click New again, type onMouseout in Name and the following in Value:
this.style.backgroundColor='#CACACA'
This brings the rollover back to the neutral state, otherwise it would "stick" in the mouseover state. Again, remember those single quotes around the colour name. You will also notice that I have omitted the ending semi-colon on both mouse events (Mouseover and Mouseout) as well as the cursor style for Mouseout —this is as it should be. So, click OK to confirm the input. Click OK again to save every code bit and return to the layout view. Last, put some content in your cells —text or graphic— because otherwise the rollover won’t work at all. Now test your html rollover in a browser. Any modern, javascript-enabled browser will do. What you should see is a cell that is greyish in the normal state, yellow on mouseover and back to greyish when you move the pointer off the cell. It may be necessary to tweak a few other details, in the text styles f.i, to get everything as you like it (for example, set cell alignment to middle and text alignment to center to have the text land square in the middle of the cell). If it’s not working, go back and look at your code input. Check for misspellings, use of commas instead of periods; things like that.

This is just one of the many things you can do with the Extended... button/feature. Another thing that’s fun to play with is extending a text style. Say for instance that you want to add margin to a block of HTML text? Learn how, here.

Google

WWW 180mph

Colophon

180 mph is a periodically published website and PDF magazine, created by Fred Kylander of Glimmerman Design. The purpose of 180 mph is to serve as an independent resource for users of the web desktop publishing software Freeway, by Softpress Systems Ltd. Neither 180 mph nor Glimmerman Design are affiliated or connected to Softpress Systems in any way. For official information about Freeway, please visit the Softpress web site.

180 mph is produced on an Apple G4, 17" Powerbook. The magazine is produced with Adobe InDesign 3, Illustrator 11 and Photoshop 8 (CS). The website is produced with Freeway Pro 3.5, SubEthaEdit 2 and Adobe Photoshop 8. Other hardware include a Canon EOS 300D and a Wacom Intuous tablet.

ISSN 1652-1652-8085