PDA

View Full Version : Advanced Gallery script: Links to Content in Viewer



lknoles
07-14-2006, 07:08 PM
1) Script Title: Advanced Gallery script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/agallery.htm

3) Describe problem: I'm working on a site that has long, content-rich pages and I would like to use the Advanced Gallery script, the Switch Content Script, or another script from the Dynamic Content section of your site in to allow visitors to choose which sections of the page they would like to view. However, anchors or links only work when the particular section in which the link appears is on display. Is there a solution to this problem? Thanks.

jscheuer1
07-16-2006, 05:03 AM
links only work when the particular section in which the link appears is on display.

How would or could any link work when it wasn't being displayed? How would anyone even know that it was there? If a link is so important that it must be available at all times, put it in a section of the page that is always visible.

If I have misunderstood the situation, please provide a link to your page and a better explanation of the problem.

lknoles
07-16-2006, 12:37 PM
Thanks for your question and sorry for being confusing. I'm new to this and in over my head.

Here's the format I'm trying to use on my pages:

1) an always-visible paragraph that summarizes the information available as dynamic content below.

2) a menu so that users can choose which topics they wish to see in the gallery viewer which appears below the menu.

I would like to be able to put anchors in the summary (or on other pages of the site) so that users could call up a topic of interest in the gallery viewer. However, normal anchors only work if the topic has already selected that topic in the menu and opened it in the gallery viewer.

You can see an example of a page using the Advanced Gallery Script at: http://mac110.assumption.edu/aas/intros/b.html.

Another experiment using Switch Content Script II http://www.dynamicdrive.com/dynamicindex17/switchcontent2.htm can be seen at http://mac110.assumption.edu/aas/intros/c.html I can set up the page so that everything is expanded at the beginning and all the anchors work, but that defeats the purpose of having a page that looks less overwheming when you open it.

Thanks for any help you can give. As I said, I'm in over my head.
Is there a way to have the anchors open the dynamic content? Do I need a different solution entirely?

Lucia

jscheuer1
07-16-2006, 04:51 PM
I see. I worked out a solution for linking to a page and opening a content block and for opening a content block on a page from a link outside the content menu using Switch Content Script (http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm). Here is a link to that thread containing that solution and a link to a demo of it:

http://www.dynamicdrive.com/forums/showthread.php?t=4138

Your situation is a little different in that you also want to anchor link to that open section on the page. That may be able to be done, but it might not. If possible, it would be tough to work out. There is an easier approach to the same effect. That would be to have your anchor outside the area that is displayed/not displayed, just above it or below it. If you set up the switch content script to always collapse previous, you would need only one anchor link for all contents as, once displayed, any given revealed content will be at the same spot on the page as any other.

lknoles
07-16-2006, 08:15 PM
Ah, progress, thanks to your advice. I have been able to use the answer you provided to link to a page with dynamic content, and have a specific block of content open up to view. However, the link takes the visitor to the top of the dynamic page, and since the gallery viewer is at the bottom of the page, s/he is unlikely to notice the dynamic material to which the link/anchor was intended to refer. You can see how this works by going to http://mac110.assumption.edu/aas/intros/f.html

If this was a "normal" kind of web page, I would use a link with an anchor:

<a href="c.html#history">

So I have tried to incorporate an anchor into the code you suggested

<a href="c.html#history?sc=3">
but it doesn't work. Any more thoughts? Your help has been VERY valuable, and I really appreciate it.

Incidentally, the discussion thread you linked me to also offered a solution I've been able to use in order to create anchors to dynamic material on the same page:

<a href="#" onClick="expandcontent(this, 'sc2')" >Link text here</a>

I've tried that on an experimental page and it works. You can see how the anchors work by trying the links in the opening summary:
http://mac110.assumption.edu/aas/intros/e.html

Thanks again for all of your help. The clouds are beginning to lift.

Lucia

jscheuer1
07-17-2006, 05:54 AM
Change this line:


var scNum=unescape(location.href).substr(unescape(location.href).indexOf('?sc=')+4)

to:


var scNum=parseInt(unescape(location.href).substr(unescape(location.href).indexOf('?sc=')+4))

Move this anchor:


</blockquote>
</div>

<h3 align="center" class="style4" style="cursor:hand; cursor:pointer" onClick="expandcontent(this, 'sc3')">The First African-American Regiments and Their Reception</h3>
<div id="sc3" class="switchcontent">
<blockquote>
<p align="left"><a name="history"></a>Many of the sol

to here:


</blockquote>
</div>
<h3 align="center" class="style4" style="cursor:hand; cursor:pointer" onClick="expandcontent(this, 'sc3')">The First African-American Regiments and Their Reception</h3>
<a name="history"></a>
<div id="sc3" class="switchcontent">
<blockquote>
<p align="left">Many of the sol

Link to the page using this syntax:


<a href="e.html?sc=3#history">Link Text</a>

lknoles
07-17-2006, 09:47 AM
WOW! I had just about given up trying to solve that problem. Thanks for your help--it will make a tremendous difference in my project.

Lucia