<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Want to include Fancybox in NodeBB without a plugin?]]></title><description><![CDATA[<p dir="auto">That’s exactly what I wanted to do. You may have noticed that the images here are handled via Fancybox, and you can do the same with your own forum as follows</p>
<ol>
<li>Add the below into the ACP-&gt;Custom Header</li>
</ol>
<pre><code>&lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.css"/&gt;
&lt;script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.js"&gt;&lt;/script&gt;
</code></pre>
<ol start="2">
<li>Add the below into the ACP-&gt;Custom JS</li>
</ol>
<pre><code>// Fancybox wrapper

if (top.location.pathname !== '/login') {
    $(window).on('action:ajaxify.end', function (data) {
        this.$('img').not('.forum-logo').each(function () {
            // Strip out the images contained inside blockquotes as this looks nasty :)
            $('blockquote img').remove();
            Fancybox.bind(
                'a[href*=".jpg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"], a[href*=".webp"]',
                {
                    groupAll: true,
                }
            );
        });
    });
}
</code></pre>
<p dir="auto">Note, that I included a check to exclude the login path</p>
<pre><code>if (top.location.pathname !== '/login') {
</code></pre>
<p dir="auto">The reason for this is that some of the SSO icons are actually images, so clicking these to login actually triggered Fancybox, which was not the desired effect.</p>
<p dir="auto">if you aren’t using SSO or this particular issue doesn’t matter to you, you can change this to</p>
<pre><code>    $(window).on('action:ajaxify.end', function (data) {
        this.$('img').not('.forum-logo').each(function () {
            // Strip out the images contained inside blockquotes as this looks nasty :)
            $('blockquote img').remove();
            Fancybox.bind(
                'a[href*=".jpg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"], a[href*=".webp"]',
                {
                    groupAll: true,
                }
            );
        });
    });
</code></pre>
<p dir="auto">I also use the line</p>
<pre><code>$('blockquote img').remove();
</code></pre>
<p dir="auto">This strips the images from blockquotes - otherwise, they are simply duplicates. Again, if you actually want this behaviour, you can just remove this line.</p>
<p dir="auto">Enjoy !</p>
]]></description><link>https://sudonix.org/topic/231/want-to-include-fancybox-in-nodebb-without-a-plugin</link><generator>RSS for Node</generator><lastBuildDate>Sun, 07 Jun 2026 05:31:19 GMT</lastBuildDate><atom:link href="https://sudonix.org/topic/231.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 18 Feb 2022 16:42:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Want to include Fancybox in NodeBB without a plugin? on Fri, 18 Feb 2022 20:23:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/phenomlab" aria-label="Profile: phenomlab">@<bdi>phenomlab</bdi></a></p>
<p dir="auto">haha!!<br />
You are crazy. In a good way, of course <img src="https://sudonix.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=9c043d314b9" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">It’s a way of saying you’re awesome !</p>
]]></description><link>https://sudonix.org/post/2808</link><guid isPermaLink="true">https://sudonix.org/post/2808</guid><dc:creator><![CDATA[DownPW]]></dc:creator><pubDate>Fri, 18 Feb 2022 20:23:05 GMT</pubDate></item><item><title><![CDATA[Reply to Want to include Fancybox in NodeBB without a plugin? on Fri, 18 Feb 2022 19:40:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/downpw" aria-label="Profile: DownPW">@<bdi>DownPW</bdi></a> not simple, no, but certainly possible with a little “imagination”</p>
]]></description><link>https://sudonix.org/post/2807</link><guid isPermaLink="true">https://sudonix.org/post/2807</guid><dc:creator><![CDATA[phenomlab]]></dc:creator><pubDate>Fri, 18 Feb 2022 19:40:29 GMT</pubDate></item><item><title><![CDATA[Reply to Want to include Fancybox in NodeBB without a plugin? on Fri, 18 Feb 2022 18:27:23 GMT]]></title><description><![CDATA[<p dir="auto">what would be great is to have a carousel directly in a thread but in my opinion it is not simple !</p>
<p dir="auto"><a href="https://fancyapps.com/docs/ui/carousel" target="_blank" rel="noopener noreferrer nofollow ugc">https://fancyapps.com/docs/ui/carousel</a></p>
]]></description><link>https://sudonix.org/post/2806</link><guid isPermaLink="true">https://sudonix.org/post/2806</guid><dc:creator><![CDATA[DownPW]]></dc:creator><pubDate>Fri, 18 Feb 2022 18:27:23 GMT</pubDate></item><item><title><![CDATA[Reply to Want to include Fancybox in NodeBB without a plugin? on Fri, 18 Feb 2022 17:22:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/downpw" aria-label="Profile: DownPW">@<bdi>DownPW</bdi></a></p>
<blockquote>
<p dir="auto">I would be interested in the sense that I use the light gallery plugin on NodeBB so as not to have posts with lots of images one below the other, but it is buggy.</p>
</blockquote>
<p dir="auto">Yes, I saw that too. Plus, the latest version of Fancybox has no reliance on jQuery or other external libraries, so it’s much faster, and has a smaller footprint.</p>
<blockquote>
<p dir="auto">How does displaying galleries work in a NodeBB post?</p>
</blockquote>
<p dir="auto">Good question. It would be easy to extend the initial code in the first post by implementing some of the features on offer here</p>
<p dir="auto"><a href="https://fancyapps.com/docs/ui/fancybox/" target="_blank" rel="noopener noreferrer nofollow ugc">https://fancyapps.com/docs/ui/fancybox/</a></p>
]]></description><link>https://sudonix.org/post/2802</link><guid isPermaLink="true">https://sudonix.org/post/2802</guid><dc:creator><![CDATA[phenomlab]]></dc:creator><pubDate>Fri, 18 Feb 2022 17:22:09 GMT</pubDate></item><item><title><![CDATA[Reply to Want to include Fancybox in NodeBB without a plugin? on Fri, 18 Feb 2022 17:18:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/phenomlab" aria-label="Profile: phenomlab">@<bdi>phenomlab</bdi></a></p>
<p dir="auto">Oh yeah, it’s very good <img src="https://sudonix.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=9c043d314b9" class="not-responsive emoji emoji-android emoji--wink" style="height:23px;width:auto;vertical-align:middle" title=";)" alt="😉" /><br />
I didn’t know Fancybox but I see that we can manage image galleries !</p>
<p dir="auto">I would be interested in the sense that I use the light gallery plugin on NodeBB so as not to have posts with lots of images one below the other, but it is buggy.</p>
<p dir="auto">How does displaying galleries work in a NodeBB post?</p>
<p dir="auto">Great Post <img src="https://sudonix.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=9c043d314b9" class="not-responsive emoji emoji-android emoji--wink" style="height:23px;width:auto;vertical-align:middle" title=";)" alt="😉" /></p>
]]></description><link>https://sudonix.org/post/2801</link><guid isPermaLink="true">https://sudonix.org/post/2801</guid><dc:creator><![CDATA[DownPW]]></dc:creator><pubDate>Fri, 18 Feb 2022 17:18:55 GMT</pubDate></item></channel></rss>