Happy birthday, Dad!
Monday, June 27, 2016
The weather has finally picked up a bit - just in time to wish you a very happy birthday!

See More: #birthday  |
![]() | Posted by Danica Scott at 17:26 |
| comments 1 |
The weather has finally picked up a bit - just in time to wish you a very happy birthday!

See More: #birthday  |
![]() | Posted by Danica Scott at 17:26 |
| comments 1 |
So I thought it was about time mybigadventures became a bit more mobile. When I recently re-designed the site I didn't think much about making everything work on smaller devices and having checked the website on my mobile this was pretty clear. The site looks great on my laptop where it has mostly been viewed but on smaller devices the text is too small and thtere's just too much going on. I didn't really want to start from scratch and make a mobile site so I went for a much faster and simpler solution using CSS media queries.
If you haven't used CSS queries before they're essentially a set of rules that you can add to the CSS to control when certain CSS styles should be applied. What this means in practice is that you can add media queries to test the width of the browser used to view your site and change the size of your content accordingly. In my case, to make the site more mobile friendly, at certain page widths I hide some of the content and increase the font size. The code looks a bit like this:
@media (max-width: 1199px) {
p {
font-size:140%;
}
}
All this will do is if the browser width is less than 1200 pixels, it will increase the font size by an additional 40%. Simple! You can see this in practice if you're viewing the site using a destop or laptop computer. Just resize the browser window to make it smaller and watch the layout change. The downside of course is that because some of the content is simply hidden, it doesn't stop the device you're using from downloading it (so you're downloading content you'll never see). It also currently means that some of the content that enables you to interact with the website is currently unavailable (viewing anything other than the most current blog, logging in, adding comments).
It's certainly far from perfect but it'll do the job for now.
A couple of weeks ago I gave the existing hand coded lightbox an overhaul and replaced it with the much better looking JQuery FancyBox 2 plugin fancyapps.com/fancybox/. It was very quick and easy to set up and was soon working. It wasn't long however before I started tinkering. Previously I had a comments section in place, and it wasn't clear how to make this work with the new fancybox set up. I had a look around on the Internet and found a few implementations that customised the title section for each photo, but this wasn't quite what I wanted. In the end I decided on a custom comments box to the right of the screen (You can see this in action by browsing any of the photo albums).
The first job was actually getting a box on the right side of the screen. This turned out to be a little more challenging than first anticipated. In the end, it was achieved by specifiying a margin in the fancybox options, and then using the aftershow callback to populate the comments. I've included the code below for those that are interested:
$('.fancybox').attr('rel', 'gallery').fancybox({
margin: [20, 300, 20, 20],
afterShow: function(){
var commentsContainer = "<div class='lightboxcomments'></div>";
if ($(document).find('.lightboxcomments').length == 0) {
$('.fancybox-overlay').append(commentsContainer);
}
//CODE GOES HERE TO POPULATE COMMENTS
}
});
Each time it loads a new photo, it checks to see if the comment div exists and if not, it adds it to the DOM. It then uses a JQuery getJSON() call with a callback to populate the comments when loaded from the database. I'm sure there are probably better / more efficient ways to achieve the same thing, but it does the job well for now.
I'm up in Sheffield for mums birthday weekend and today we headed over to Shireoaks for their armed forces day fair. There were some army trucks and fighter jet cockpits to look at in addition to a drumming band and army assault course. The weather has been great, very sunny and warm with just a bit of a breeze. It's also the Steam Fair weekend so might try and see that tomorrow. I've added a few photos to the album linked below.

© Ben Taylor 2026 all rights reserved
