Search…

X3 Photo Gallery Support Forums

Search…
 
jakob
Topic Author
Posts: 5
Joined: 12 Oct 2019, 03:36

links within a page - help needed

18 Oct 2019, 17:33

Hello,

I am embarrassed to ask: I have a longer content with a bit of text and I want links within the content (e.g. to a certain lens).
I searched the forum plus google and tried so many things but couldn't get it to work.  Surely someone can help!

thanks a lot
Jakob
 
jakob
Topic Author
Posts: 5
Joined: 12 Oct 2019, 03:36

Re: links within a page - help needed

19 Oct 2019, 02:22

In case my request is too fuzzy, I am looking for a simple anchor to jump down to a text paragraph within the text content of a page.
I found and tried this
viewtopic.php?f=52&t=8455&p=36078&hilit=anchor#p36078
but nothing happens if I click on the link.
thanks
Jakob
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: links within a page - help needed

19 Oct 2019, 03:30

X3 is a bit special, because we have to hi-jack all links via Javascript to detect if they are internal links that navigate via "ajax" to other X3 pages. It's likely you did it right already, but you need to include a special "no-ajax" class on the link, so that it is excluded from being hi-jacked by X3. For example, add your link like this:
Code
Click <a href="#mytarget" class="no-ajax">here</a> to go to #mytarget element.
Then, for the element you want to scroll to when clicking the link above, you would use something like this:
Code
<div id="mytarget"></div>
The target element can be any html element, <div>, <h1>, <a> etc. It doesn't need to contain any content, and can just be an empty placeholder to the location you want to scroll to.
 
jakob
Topic Author
Posts: 5
Joined: 12 Oct 2019, 03:36

Re: links within a page - help needed

19 Oct 2019, 06:42

Thank you so much, works just fine!!!
My page is growing and I really enjoy working on it.

Jakob
 
User avatar
JMM
Experienced
Posts: 154
Joined: 02 Aug 2021, 11:18

Re: links within a page - help needed

10 Aug 2023, 21:27

Hello, Karl,

Sorry for piggy-backing off of this 4-year-old post.

I understand the concept of these "anchors" to jump to specific parts of a page, and I have been using them on my non-X3 sites for more than a decade.  And I also understand the context in which Jakob is using this method to jump to specific "text" on a page.

My question here is, is it possible to also allow jumping to specific images on a page?  I need to clarify exactly what I mean...

I am considering having a handful of folders (galleries) which consist solely of images, instead of having sub-folders that contain the groups of images.  There would be many hundreds of images in those galleries.

I have created a test folder HERE, in which for now I've just copied a bunch of images for testing-purposes, but none of which will be in the planned folders.

There are 4 groups of aircraft in that test folder, separated by the "seperator" images with the 2 neon arrows, and which are named accordingly so that they are at the beginning of each group.

If I use my browser's (Chrome's) search feature (Control-F), provided that I have caption-overlay enabled, I can search for specific images on the page, and that works quote well, and I'm happy with that  :slight_smile:.

I doubt that I am able to search for images (as opposed to text) using anchors in X3, but thought I would ask anyway.  As it's most-likely not possible, no need for you to waste your time explaining why it is not possible  :upside_down:.

I had tried placing the element
Code
<div id="mytarget"></div>
...in the description of the 1st divider image, hoping that X3 would find the anchor there when the link at the top of the page is clicked on from the custom page content page, but as I expected it did not work.
I realize that I could just use the cuctom content page to divide the groups up, but with many hundreds of images it would quickly become unmanageable.
Again, I am very happy that the browser's search feature works great, but wanted to confirm whether using anchors to search for specific images on a page is definitely out of the question.
Thanks in advance.
John
Location: Burlington (Toronto-ish), Ontario, Canada
Self-hosted using Abyss Web Server:   AuroraWings.me   |   GalleryWings.com   |   PanAurora-Studio.com   |
Externally-hosted using LiteSpeed/Apache Web Server:   GenealogyWings.com/galleries   |
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: links within a page - help needed

10 Aug 2023, 22:32

JMM wrote:I had tried placing the element
Code
<div id="mytarget"></div>
That wouldn't work, because <div> is not allowed in descriptions (it's block-level and would break descriptions), and also since the element is hidden, it just wouldn't work.

There is already an ID for each image, allowing you to link to images directly:
https://galleries.fusionwings.com/test_ ... -a-divider

Keep in mind, it will strip characters that are not compatible with html attributes (ID), so it wouldn't always be identical to names containing chars like ~~. Also, I haven't tried, but I don't think this will work if you link to pages like this from the menu, because the menu will load pages dynamically and inject the data into page ...

It will probably be quite tedious to solve your categorizing properly like this.

In future X4, you will likely have capabilities like our demo.files.gallery to filter (search) images on page, and possibly predefine clickable filters, which could be used to sort images in one folder into multiple cateogries.
 
User avatar
JMM
Experienced
Posts: 154
Joined: 02 Aug 2021, 11:18

Re: links within a page - help needed

10 Aug 2023, 23:31

In future X4, you will likely have capabilities like our demo.files.gallery to filter (search) images on page, and possibly predefine clickable filters, which could be used to sort images in one folder into multiple cateogries.
Yes, I've seen you mention this in various replies to people over the months, and am patiently waiting for its release.

There is already an ID for each image, allowing you to link to images directly...
Magic!  It never ceases to amaze me all of the capabilities that you've written into your X3.  Thank you for a wonderful product.  I tried your example, and it works great... almost.

If I add target="_blank", it works, but opens in a new page (tab), which is what target="_blank" does.  However, I would want it to open in the same page (i.e. just to jump down to that section), or to refresh the same page but with jumping down to that section, which is quite possibly asking for the impossible.  I tried it with:
Code
<a href="https://galleries.fusionwings.com/test_area/test_anchor_folder/#image-cp121-a-divider" target="_blank">Test link</a> (target = _blank)
<br>
<a href="https://galleries.fusionwings.com/test_area/test_anchor_folder/#image-cp121-a-divider" target="_self">Test link</a> (target = _self)
<br>
<a href="https://galleries.fusionwings.com/test_area/test_anchor_folder/#image-cp121-a-divider">Test link</a> (no target)
...only the target=_blank works... the other 2 do not work at all (nothing happens).

But if the jumping down to that section on the same page is not possible, I am fine just to use the browser's CTRL-F to search for & jump down that way  :slight_smile:.
Location: Burlington (Toronto-ish), Ontario, Canada
Self-hosted using Abyss Web Server:   AuroraWings.me   |   GalleryWings.com   |   PanAurora-Studio.com   |
Externally-hosted using LiteSpeed/Apache Web Server:   GenealogyWings.com/galleries   |
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: links within a page - help needed

11 Aug 2023, 05:28

JMM wrote:
Code
<a href="https://galleries.fusionwings.com/test_area/test_anchor_folder/#image-cp121-a-divider">Test link</a> (no target)
If you are linking to items on the SAME page, you could use only the ID:
Code
<a href="#image-cp121-a-divider">Test link</a>
This will work fine to scroll to the specified ID. However, it will not work when linking to an ID on a different page, using internal page loading.
 
User avatar
JMM
Experienced
Posts: 154
Joined: 02 Aug 2021, 11:18

Re: links within a page - help needed

12 Aug 2023, 00:29

Everything works perfectly, exactly what I had wanted.

Thank you again, and have a great weekend.
Location: Burlington (Toronto-ish), Ontario, Canada
Self-hosted using Abyss Web Server:   AuroraWings.me   |   GalleryWings.com   |   PanAurora-Studio.com   |
Externally-hosted using LiteSpeed/Apache Web Server:   GenealogyWings.com/galleries   |