User Name
Password
AppleNova Forums » Programmer's Nook »

JQuery scrollto and the DOM


Register Members List Calendar Search FAQ Posting Guidelines
JQuery scrollto and the DOM
Thread Tools
drewprops
Magnificent Basturd™
 
Join Date: May 2004
Location: Atlanta
 
Old 2011-09-21, 16:17

This isn't a television show.

I'm supposed to have a nav link that, when opened, takes you to an anchor in the page.

Of course this works fine in normal situations, but in this case we're using the JQuery Accordion routine to collapse a lot of the information on the page. Some of the collapsed DIVs contain images.

So of course the problem is that when the browser goes TO the correct anchor, the images haven't completed loading (the DOM isn't finished??) and so the target is "shifted" offscreen making it look like an error.

I'm investigating using the JQuery "scrollto" routine, but am not yet sure if that will work.

Alternately I'm wondering if the solution might be as simple as specifying the height of the images in the HTML.

Does any of this make sense to you folks?

ta.


...

Steve Jobs ate my cat's watermelon.
Captain Drew on Twitter
drewprops is offline   quote
Ryan
Veteran Member
 
Join Date: May 2004
Location: Tejas
 
Old 2011-09-22, 13:31

Unless the server these images are on is incredibly slow, I’d use .scrollTo. I’m using that in a project at work right now and it’s pretty good.
Ryan is offline   quote
drewprops
Magnificent Basturd™
 
Join Date: May 2004
Location: Atlanta
 
Old 2011-09-22, 16:41

I'm betting that you haven't used scrollto as a link to an anchor on a target page, and when employing collapsed DIVs with the Accordion script ON that target page.... or are you? (hopeful, but not too hopeful)

I've been given permission for a workaround in the organization of info on the site in lieu of spending 3 days teaching myself the ins and outs of the DOM. It would indeed be cool to learn more, but getting the job done is JOB #1 ;D


...

Steve Jobs ate my cat's watermelon.
Captain Drew on Twitter
drewprops is offline   quote
Ryan
Veteran Member
 
Join Date: May 2004
Location: Tejas
 
Old 2011-09-22, 21:33

Quote:
Originally Posted by drewprops View Post
I'm betting that you haven't used scrollto as a link to an anchor on a target page, and when employing collapsed DIVs with the Accordion script ON that target page.... or are you? (hopeful, but not too hopeful)

I've been given permission for a workaround in the organization of info on the site in lieu of spending 3 days teaching myself the ins and outs of the DOM. It would indeed be cool to learn more, but getting the job done is JOB #1 ;D


...
Yea, I have actually. About to go live Monday.

The whole site is one long scroller with a fixed navbar and links on the page to collapsible divs. Basically what you need to do is add a class like ”toCollapsible” to any link that could go to a hidden target. Bind a new function to the click event of those links and then use the href to find the target in question. Use $.parent to walk up the DOM recursively checking if each one is hidden and un-hiding them in they are, stopping when you reach a visible parent.

Though I’m not using jQuery UI’s accordion, just doing that manually as the UI option didn’t do what I needed. It should work the same way though. Now that I think about it, easier actually. Just walk up $.parent till you find the accordion, check if it’s hidden and show it.

edit: Just realized that you’re probably talking about a link on another page to a target with a bunch of accordions. If so I’m not sure how I’d handle that. Maybe the BBQ plugin?
Ryan is offline   quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Reply

Forum Jump
Thread Tools

« Previous Thread | Next Thread »

All times are GMT -5. The time now is 15:43.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2012, AppleNova
AppleNova Slim