PDA

View Full Version : problem removing an element in a timely fashion


TalkieT
Oct-30-2009, 04:56 PM
I have recently added in a 'recent galleries' hack which works great.. I ended up replacing 'recent photos' so I could keep my featured galleries as well..

Anyway, I wanted to have both featured and recent galleries on my homepage, and I wanted a nice title for them, so I re-enabled the .boxtop for them, and made them a nice background image with the "featured" and "recent" titles.

I also removed the text from the .boxtops with the following code in my top JS section..

// Remove text from boxtop for Featured Galleries
YE.onContentReady('featuredTitle', function() {this.innerHTML=''});

// Remove text from boxtop for recent photos
YE.onContentReady('recentPhotosBoxTitle', function() {this.innerHTML=''});

This works great on Firefox, the text is removed instantly and looks good.

on IE however, the default text stays there until the page is almost completely rendered and then it disappears. I suspect this is something to do with onContentReady, but I honestly cut and pasted that and I don' fully understand if there's a better way to remove the text ("Featured Galleries" and "Recent Photos") than the way I came up with.

My site is www.nzsnaps.com and I'd be grateful if there was a way to make the rendering of the page a little cleaner.

Cheers - Neil Gardner
www.nzsnaps.com

jfriend
Oct-30-2009, 05:34 PM
No need for a script at all. It's much better to just use this CSS:

#featuredTitle, #recentPhotosBoxTitle {display:none;}

FYI, the delay in IE is because IE is lame and the page is not allowed to be modified until the whole page has loaded (or IE will crash). Thus, your scripts can't run until the whole page is loaded. The CSS method will not have that issue - the titles will never show.

TalkieT
Oct-30-2009, 05:39 PM
No need for a script at all. It's much better to just use this CSS:

#featuredTitle, #recentPhotosBoxTitle {display:none;}

FYI, the delay in IE is because IE is lame and the page is not allowed to be modified until the whole page has loaded (or IE will crash). Thus, your scripts can't run until the whole page is loaded. The CSS method will not have that issue - the titles will never show.

Ahhhhhhhhh

Thanks John... The reason I was using the overkill CSS was because I adapted the recent galleries hack which changed the text from "recent photos" to "recent galleries"... The CSS is much cleaner - I'll fix it up now.

Cheers - N