Thread Rating:
  • 3 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[For 1.8] Fancybox / "Fit on page"
#1
Hello,
I looking for someting like "fit on page" for MyBB 1.8, but without results. Auto-scaling is good, but not comfortable for me. I tried some code and "find solution". Caution: it's very, very simple and may not work on all boards.

1. Add to you theme css:

.scaleimages img {

 max-width: 400px;
max-height: 400px;
}

This 400px in only example - align to your board.


2. Download fancybox plugin and upload to server.
http://fancyapps.com/fancybox/3/

Files should be in mybb_root/fancybox


3. Add to headerinclude template after {$stylesheets}:


<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css" type="text/css" media="screen" />
<script type="text/javascript" src="/fancybox/jquery.fancybox.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
   $('.post_body img').each(function() {
 var currentImage = $(this);

 if (currentImage.hasClass('smilie') == false && currentImage.parent().is('a') == false) {
 currentImage.wrap("<a target='_blank' data-fancybox data-type='image' href='" + currentImage.attr("src") + "'</a>");
 }
   });
 });
</script>


This code add links to all images and Fancybox.



4. Edit template postbit_attachments_thumbnails_thumbnail

Change:

<a href="attachment.php?aid={$attachment['aid']}"

to:

<a href="attachment.php?aid={$attachment['aid']}" data-fancybox="data-{$attachment['aid']}" data-type="image"



Voilà!



Demo:
https://mybboard.pl/thread-61804.html


   
Reply
#2
Hi lukasamd ,
It this can update to fancyBox-3.0 ?
My favorite theme NetPen Premium
Reply
#3
I think yes, but must check that. I will do it and update thread. Thanks for info about new fancynox Wink
Reply
#4
Thanks , i will wait for the update and it will benefit for all user Smile .
My favorite theme NetPen Premium
Reply
#5
i use this allways on my forums it can be done for videos and use group image as elements of a group using the code and goes fine. Even it works with mobile versions so i think is a god one library for elements in posts aswell.
The only infinite thing is the universe and human stupidity, but the universe is not for sure

Plugins 1.6.x

Plugins 1.8.x

Reply
#6
is possible to add some buttons on the bottom? Open in full size, zoom etc? Somethunk like highslide plugin
[MyBB 1.8 Czech translation] [MyBB 1.8 plugins]: Prune old PMs + optimize DB plugin --- Thank you/like system
Reply
#7
@Eldenroot in new fancybix 3 is a lightweight and yes it has all addittions i have it on my site and it has a zoom, captions and more. But i think highslide is a good one too but i test both of them and i think is at own choice. But i have to see more about new 3.0 of fancybox is better than 2.x aswell And i have reviewed highslide 5 so i think any of them can be used with mybb and customized by you at your owns Smile
The only infinite thing is the universe and human stupidity, but the universe is not for sure

Plugins 1.6.x

Plugins 1.8.x

Reply
#8
@Dark Neo - can you please share how to use fancy box v3? It seems to be more lightweighted and faster, thank you!
[MyBB 1.8 Czech translation] [MyBB 1.8 plugins]: Prune old PMs + optimize DB plugin --- Thank you/like system
Reply
#9
I updated first post to use Fancybox 3.0.
I also added fix fox smiles.
Reply
#10
(02-26-2017, 06:13 PM)lukasamd Wrote: I updated first post to use Fancybox 3.0.
I also added fix fox smiles.

Thanks , i will try right now . Smile

---------------------------------------------------------------------------------------------------
Edit : Want to double confirm which plugin i need to upload to my root .
My favorite theme NetPen Premium
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)