glen, you're a star. thanks mate. do you mind if i use that little snipped of code on this project? i've compared the JQ pieces side by side and see what you mean about eliminating 90% of my code (i believe you're referring to my JQ here and not my CSS). like you say getting used to the DOM takes time and it's really bad but i'm always referring to the DOM when i'm on projects for others and never experimenting with things enough in my own time - this will change now i know there's a community of friendly people here to provide helpful advice! it's more fun when you know you're not alone.
regarding your second point about using classes instead of IDs in my XHTML, i agree, but i am under the impression that warranting the use of classes on elements should only occur if you plan to re-use the object, otherwise ID it - i stand by this ethos, but i'm not as adept with JQ as you right now, so things may change. i am aware of ID overuse though and try to use as few as possible. is there some sort of speed issue with how JQ handles IDs as opposed to classes then? regarding your third and final point. in retrospect i should have used pure HTML for the navigation. however, i'm doing this for a client and after showing him the designs for the site, which they were very happy with indeed, i feel it would suck to have to go back to him with something different (albeit, not that different re: arial). in future i will probably take your advice. i take your point about zooming/ enlarging fonts - accessibility could be better on the nav, but there's due to be a site map list down the left of each page, so it's not that much of an issue. if the sitemap wasn't there i would definitely be doing this in HTML like you suggest. sorry if i sound like a justifying old ponce, i like being picked on in this way, haha. maybe someone reading this can learn something from a neutral perspective and realise why we take these kinds of decisions on projects. again, glen = absolute star. lewis ps. i'll have hours of fun now! (http://docs.jquery.com/Traversing/ children#expr) On Sep 6, 9:29 pm, "Glen Lipka" <[EMAIL PROTECTED]> wrote: > I whipped up a demo.http://www.commadot.com/jquery/hoverIntent/menu.htm > > Some pointers: > 1. You only need one ready block. No need to make one for every single > call. > 2. Use CSS classes. Avoid ID's. jQuery is much easier to work with when > your page has no ID's on it. CSS is super powerful. jQuery and CSS are > like "slicing" and "bread". You just cant do one without the other. By > using CSS, I eliminated 90% of your code. Redundancy is bad for > maintenance. My code actually could be even shorter. > 3. Use HTML instead of images for the links. It doesn't look sharp. It's > very bad if I wanted to increase font size (poor eye sight). Its less > flexible. You can get almost an identical look using Arial in this case. > > Ok, enough picking on you. Getting used to jQuery is a big first step. But > once you do, you will open up tremendous doors for your users. > > Glen > > On 9/6/07, ldexterldesign <[EMAIL PROTECTED]> wrote: > > > > > also is there any way to make my jquery code a bit leaner? i assume > > that's really sloppy code there??! > > > On Sep 6, 8:06 pm, ldexterldesign <[EMAIL PROTECTED]> wrote: > > > right guys, hopefully you're still about and can provide some back-up > > > on this one. > > > > i've taken into consideration and implemented both points, although i > > > have the funny feeling doing both has cancelled each of your much > > > appreciated solutions out. my code is much leaner, cleaner, and valid > > > - so pat yourselves on the back for me. > > > > have another look if you'd be so kind (and anyone else that happens to > > > check out this topic tonight) and see if you can think of/suggest a > > > solution to the problem of my secondary nav disappearing before i get > > > the chance to select a link: > >http://www.personal.leeds.ac.uk/~scs4ll/index.html > > > > many thanks, > > > lewis > > > > On Sep 6, 12:00 am, ldexterldesign <[EMAIL PROTECTED]> wrote: > > > > > thanks guys, i'll try implementing both of your ideas and get back to > > > > this thread once i have some resolve. > > > > > for anyone that checked my url above - the files have been overwritten > > > > since i received these two responses, so i don't expect anyone to make > > > > much sense of what's there now. > > > > > big up, > > > > lewis > > > > > On Sep 5, 8:11 pm, Renaud <[EMAIL PROTECTED]> wrote: > > > > > > Just my two cents, but changing your html structure could solve a > > lot > > > > > of problems, including this one. > > > > > > Imho, each one of you *_set_navigation ul should be children of your > > > > > #primary navigation items, e.g: > > > > > > <li id="home" href="#" alt="Home" title="Home">home</a> > > > > > <ul id="home_set_navigation" class="hide"> > > > > > <li><a id="home_latest" href="latest" alt="Latest news" > > > > > title="Latest news">our latest</a></li> > > > > > <li><a id="home_reviews" href="music_reviews" alt="Music > > > > > reviews" title="Music reviews">reviews</a></li> > > > > > <li><a id="home_listen" href="listen" alt="Listen now!" > > > > > title="Listen now!">listen live!</a></li> > > > > > > <li><a id="home_competitions" href="competition" > > > > > alt="Competitions" title="Competitions">competitions</a></li> > > > > > <li><a id="home_get_involved" href="get_involved" > > alt="Get > > > > > involved" title="Get involved">get involved</a></li> > > > > > <li><a id="home_calendar" href="calendar" alt="Calendar" > > > > > title="Calendar">calendar</a></li> > > > > > </ul> > > > > > </li> > > > > > > That way hovering over the secondary navigation for this item wont > > > > > 'mouseout' the primary <li>. That will take some adaptation on the > > CSS > > > > > but I think that's worth it. > > > > > That way as well, clients that do not support css/javascript can > > still > > > > > have a menu that has some meaning, instead of two separate menus. > > > > > > Regards, > > > > > Renaud Drousies > > > > > > On 5 sep, 14:47, ldexterldesign <[EMAIL PROTECTED]> wrote: > > > > > > > i think you can all see what i'm trying to do here: > >http://www.personal.leeds.ac.uk/~scs4ll/index.html > > > > > > > i've coded up the 'home' and 'schedule' buttons as best i can > > (using > > > > > > the hover event). it would be nice if the secondary nav stayed up > > long > > > > > > enough for me to navigate it though. > > > > > > > any help would be much much appreciated. even a kick in the right > > > > > > direction. > > > > > > > cheers, > > > > > > lewis