Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Tweak to improve featherlight

plugins

Started by Alan Coggins 5 years ago · 3 replies · 679 views
5 years ago

I have just been playing with the featherlight plugin and it works really nicely except for one small glitch. On very narrow images the "next" button pushes the dimensions out and brings up a scroll bar. So the image keeps jumping around as you hover over it. I found a solution by reducing the font-size on the arrow from 80px down to 40px. It's in featherlight.gallery.min.css - you might need to unminify the css file first.

CSS
    .featherlight-next span,
    .featherlight-previous span {
        display: none;
        position: absolute;
        top: 50%;
        left: 5%;
        width: 82%;
        text-align: center;
        font-size: 40px;
        line-height: 80px;
        margin-top: -40px;
        text-shadow: 0 0 5px #fff;
        color: #fff;
        font-style: normal;
        font-weight: 400;
    }

While I was there I also changed the background to be darker and give more contrast.

CSS
    .featherlight-next:hover,
    .featherlight-previous:hover {
        background: rgba(0, 0, 0, 0.4);
    }

Before:
before|229x500

After:
after|239x500

last edited 11/21/21 by Alan Coggins
5 years ago

@ozfiddler, I believe this is an issue with the Gallery extension of the original Featherlight.js library itself.

Open an image in the gallery shown above and set its width to 100px. It shows the issue you are experiencing.

You might consider adding an issue or pull request at its repo.

5 years ago

Yes, have posted an issue on GitHub. Happy to do a PR, but I am still trying to work out what I think is the best solution. I am currently trying it without the opacity band down the side, and making the arrow a colour that will stand out on any image. Anyway, can discuss on GitHub if there is any interest. But apart from that it works really well. 👍

yellow|366x500

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 99 15 hours ago
General · by pamtbaau, 21 hours ago
1 63 20 hours ago
General · by Andy Miller, 1 day ago
0 48 1 day ago
General · by Marcel, 12 months ago
6 357 5 days ago
General · by Duc , 6 days ago
3 45 6 days ago