Forum Moderators: open

Message Too Old, No Replies

Function Activates onclick, switches tab/content and header image

         

nigassma

4:21 pm on Aug 19, 2009 (gmt 0)

10+ Year Member



Since javascript is my weak joint I thought I'd run this by you guys and gals.

I have a homepage and four subpages. The structure of the page:

Logo ¦ Nav
Header Image
Tabs of "sub pages"
Subpage content

I want the onclick tab action to also swap out the header image depending on what "subpage" is called via ajax.

My question then is, would the onclick function include a part that says

if onclick url=subpage1.html, then swap header and content

or should it be

if onclick url=subpage1.html then swap out entire page with new page.

I'm thinking that if the entire page fades in/out it would confuse the user more than if it was just the subpage content and header image.

Right?

daveVk

11:51 pm on Aug 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think you have over complicated this, 5 pages each with own URL and no JavaScript/AJAX will be better from search engine perspective and for users to bookmark and link to.

Swapping header + content will require 2 Ajax call or special treatment.

Loading a new page in all cases, is normal practice, and will not confuse user, as the logo and Header Images are cached, there is little overhead considerations.

nigassma

12:44 am on Aug 20, 2009 (gmt 0)

10+ Year Member



Unfortunately once we hand it over, the client will be updating these pages via a Wordpress setup. They want a different header image on each page and the homepage's subnav is tabs. I guess KISS can apply here, but each tab is a separate page/url. So if javascript is turned off it still degrades nicely. But if javascript is enabled, I thought that a little jquery easing would make it look nicer.

I don't see many people "bookmarking" a townhome description page...

daveVk, imagine a tab or image fading in and out, versus an entire page. How often do you see an entire page fade in and out? Whether the header image/logo is cached doesn't make a difference when the main nav (not tabs) is grouped into the easing function.

Sometimes text isn't as efficient as a demo I guess.

daveVk

7:28 am on Aug 20, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



each tab is a separate page/url. So if javascript is turned off it still degrades nicely

Assumable each tab/url is a partial page, less logo,nav etc, unless I misunderstand. You do not want search engines taking users to these partial pages ?

You could load the entire page and still have only the same area fade out and in, although the transition in the middle may not be as clean.

Assuming the header is just an image or at least you only need to change the image between pages then something like
$('#headImage').src = "Img1.gif" may suffice.

An alternative approach would be to include all the content in one page and use script to control what is visible, not sure if that would be Wordpress friendly ?

nigassma

5:10 pm on Aug 20, 2009 (gmt 0)

10+ Year Member



Or... (the things we think about before bed) I use a bit of php for the headers and the tabs are jquery orrrr...

I just say "f" it, K.I.S.S. and have the tabs just open to new pages! The job isn't paying enough for me to put this much effort into it.

daveVk

10:42 pm on Aug 20, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Long live Web 1.0

nigassma

10:48 pm on Aug 20, 2009 (gmt 0)

10+ Year Member



Ditto, sometimes I (and I presume many of us) get caught up with turning the awesome "on" with any site we develop. My young mind regularly forgets to compare the "man hours to dev" vs "paycheck" sides of the coin.