Client-Side menu separators with jquery

March 11th, 2007

Have you ever pulled your hair about separators between menu entries on websites? Or just plain fell asleep? The task is trivial, but it is boring. Depending on what server side solution you are using, you end up with 4 to twenty lines of code.

CSS3 would save us from that boredom, but there is almost no CSS3 support in today’s browsers. That is, there’s no native CSS3 support. We can do the same and more with jquery, which does have CSS3 support.

What I have is:
(this is the HTML as output to the browser).

<div id="mainmenu"><ul><li><a href="Impressum.html">Impressum</a></li><li><a href="UeberMich.html">Über Mich</a></li><li><a href="Moebel.html">Möbel</a></li><li><a href="Innenausbau.html">Innenausbau</a></li><li><a href="SonstigeLeistungen.html">Sonstige Leistungen</a></li></ul></div>

Which gives me this:

But what I want is:

I could inject conditions into my server-side code to insert the bullets after all but the last menu entry (or before all but the first). But this has many drawbacks: usually, there’s more conditions involved in such menus like considering hidden pages if I am working in a CMS or similar, navigation states (which is the current page, etc), and so on. Also, it makes the HTML cluttered and charges the server-side code with view-dependant details. The server-side code in this case would be considered UI-driven anyway, so this is not inherently bad. But it’s still nicer not to.

Anyway, there’s a rather easy way with jquery (if you are new to jquery, just grab jquery.js from jquery.com). The relevant code:

<script src="jquery.js" type="text/javascript"></script><script language="javascript" type="text/javascript">$(document).ready(function(){$("#mainmenu ul li:not(:last-child)").after("<li class='bull'><b>•</b></li>");});</script>

Explanations:
The $(document).ready function is executed after the DOM is completely available.
$(”#mainmenu ul li:not(:last-child)”) selects DOM elements with a CSS3 selector, in this case all li elements that have a ul as their parent and #mainmenu as their grandparent and that are not the last child of their parent.
after(”<li class=’bull’><b>•</b></li>”) simply injects the HTML after each element in the collection just selected.

The CSS, for completeness’ sake:

#mainmenu{width: 800px;border: 1px solid #006633;border-left: none;border-right: none;background-color: #e5e5e5;}#mainmenu ul{display: block;margin: 0;margin-left: auto;margin-right: auto;height: 18px;}#mainmenu ul li{display: block;float: left;margin-left: 10px;margin-right: 10px;}#mainmenu ul li.bull{margin-top: 2px;}#mainmenu ul li a{display: block;text-decoration: none;color: #006633;background-color: #e5e5e5;font-size: 14px;}

cheap abilify
acai plus
cheap accutane no prescription
discount aciphex
no rx acomplia online
Articles and actonel use in young women
actos information
aleve no prescription
Allegra De Vita
alli coupon
altace generic
acne antibiotics
off label use for aricept
arimidex nandrolone
spiritual benefits of ashwagandha
astelin tablets
buying atacand
no rx atarax
cheap augmentin no prescription
no rx avandia online
buy avapro
avodart canada
bactrim resistant uti
benadryl for cats
benicar surgery
biaxin usa
buspar xr
buy cardizem online
buy Celebrex in USA pharmacy
celadrin usa
no rx dog cephalexin
buy canada cialis
generic cipro online
Tonalin Cla Side Effects
clarinex drugs
claritin side effects
clomid and males
novo clonidine
colchicine and digestive problems
Coreg doseage
vitamin K and coumadin
cozaar price
creatine medicine
crestor and hair loss
cymbalta + hair loss
cymbalta india
depakote weight gain
diclofenac xr
differin india
diflucan medicine
diovan 80
side effects of doxycycline
side effects of effexor xr
buy flagyl 500 mg free prescriptions
flomax fda
glucophage description
compare hair loss product htm
Hangover Cure
hoodia p57
keppra withdrawal
buy lamictal
lamisil pills
lasix taking
levaquin pills
free levitra samples
lexapro reviews
lipitor description
Lisinopril 20
Side Effects of Taking Melatonin
developing gestational diabetes while taking metformin
methotrexate fda
micardis discount
no rx mobic online
motrin pills
msm gloucester
discount neurontin
nexium substitute
buy nizoral
does nolvadex burn fat3f
omnicef stool
does paxil work
how to use penis extender
PHENTERMINE
generic phosphatidylserine online
plan b withdrawal
order plavix online
pravachol joint pain
prednisone rx
mexico premarin
how to discontinue prevacid
prometrium mg
Cheap Propecia
provera canada
generic prozac
reglan price
buying reminyl
rimonabant side effects
risperdal consta
generic rogaine
cheapest seroquel
singulair allergy
buy skelaxin
stop smoking western australia
strattera for depression
stress relief desktop game
cytomel and synthroid
tetracycline medicine
topamax dosage for weight loss
cheap toprol no prescription
toradol rx
tramadol pills
trazodone tablets
tricor tablets
trileptal for depression
ultracet apap
valtrex drugs
buy viagra online inu
Prescription Drug Voltaren
vytorin medicine
weight loss canada
wellbutrin no prescription
yohimbe and weight loss
zantac otc
vision problems when taking Zetia
Prescription Drug Zestoretic Recall
buy zithromax
effexor with zoloft
zovirax canada
online zyban
taking haldol and zyprexa together
Zyrtec 10MG
online zyvox

Isorecorder by Alex Feinman

March 9th, 2007

http://isorecorder.alexfeinman.com/isorecorder.htm

Isorecorder is a free tool for Windows XP and Vista that can perform the following transformations:

CD/DVD -> ISO Image
Directory Tree -> ISO Image
ISO Image -> CD/DVD (DVD only on Vista)

Especially  the latter is a great equivalent to the ease of use that dd brings on Unix.
I  like to just save an ISO image of CDs and trash them. I don’t much like those stacks of never-used driver CDs…

Isorecorder does not mount ISO images as virtual drives.You still need Microsoft’s Virtual CD-ROM Control Panel for Windows XP, which you can download from Microsoft. The only official link to this tool is found in the MSDN FAQ. There is no corresponding page on Microsoft Downloads.

Ströer has encountered a problem and needs to close

February 26th, 2007

Every day, I walk past several Ströer appliances, and more often than not, they show interesting error messages. This time, I couldn’t resist.

Using Word 2007 to Post to WordPress

February 24th, 2007

Word 2007 works well for posting to a WordPress blog. Here is a step-by-step description.

  1. Use any existing document or create a new one. Once you’re done, hit the Office Button -> Publish -> Blog
  2. You’ll be asked to set up a blog account. Select WordPress as the blog provider and enter the URL to xmlrpc.php, your user name and your password.
  3. Then, hit the Picture Options button and enter your FTP URL and the URL used in the Blog Posts.
    For WordPress, you’ll need to use “My own server” – “My blog provider” won’t do.
    The FTP URL is where your images will be stored. Source URL is what Word will prepend to the src= attribute of the img tag.
  4. You can now publish, publish as a draft, edit categories, and edit existing posts. Wow.

A draggable masked image behind transparent navigation

March 16th, 2006

A friend asked whether it would be possible to have an image that can be dragged behind a mask, with a transparent navigation in the upper part of the page. The images are too large to fit on the page, so you need to be able to move it. Yes, they could be resized, but it’s a wanted effect.

Making things transparent in the top part is easy. A little extra treatment for Internet Explorer, and a transparent PNG will do. Making the image draggable was a single line of JavaScript with prototype/scriptaculous. Below is an example in an iframe (i know, i know, but it’s so easy this way). I have added a Fade/Appear for the navigation while the image is dragged, but it leaves the navigation hidden if the drag ends while the navigation is still fading. There certainly are ways around this, but this is enough for a proof of concept.

here is the whole thing out of the iframe