Home>Support>How to stop clicking images on Attachment page from changing pages?

How to stop clicking images on Attachment page from changing pages?

By toshiaki, 5 months ago. Last reply by Andrew Misplon, 5 months ago.

Hello.

When I click on an image on an attachment page, it takes me to the page of the next image. The URL of “Navigation to: URL” that can be seen in “#image-navigation.site-navigation” checked in Custom CSS is the URL of the attachment page after the Media image. Is it possible to change this, or at least set it so that it doesn’t jump to another page?

One method I was told was to use CSS


img {
pointer-events: none;
}

I tried it, but it made it impossible to use images with correct links on other pages, so this is no good.
Please tell me a good way to fix this.

Thank you in advance.

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 5 months, 19 days ago Andrew Misplon
    Hi, I Work Here

    Hi Toshiaki

    Thanks for getting in touch.

    If you’re able to right click in the attachment page, inspect the page source and check the body tag you’ll find CSS body classes. You can prefix your Custom CSS rule to keep it specific to the attachment page. Here is guide on prefixing rules with body classes Post: Unique Page Styling with Custom CSS Body Classes.

  2. 5 months, 14 days ago toshiaki

    Hi Andrew.

    Thanks for your reply.
    I followed your inked article and checked the CSS inspector,
    but I couldn’t find any function related to “Navigation to”.
    It seems to be something that belongs to php
    and difficult to change it.

  3. 5 months, 14 days ago Andrew Misplon
    Hi, I Work Here

    Hi, in your question you have a CSS rule. If you prefix the CSS rule with the attachment page body class, the rule will only apply to the attachment page. The attachment page body class is in the attachment page body tag which you can locate by inspecting the page source.

  4. 5 months, 14 days ago Andrew Misplon
    Hi, I Work Here
    .attachment .img {
        pointer-events: none;
    }
  5. 5 months, 14 days ago Andrew Misplon
    Hi, I Work Here

    If the above doesn’t resolve the challenge, please send a link to an attachment page you’re working on, we’ll take a look and go from there.
    Cheers!

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More