Here is my approach:
A small touch of AngularJs
var sample = angular.module('sample', []);
sample.controller('sampleCtrl', function($scope) {
$scope.pics = {};
$scope.pics.x = {
'small': 'http://placehold.it/150x150/000000',
'large': 'http://placehold.it/500x500/000000'
};
$scope.pics.y = {
'small': 'http://placehold.it/150x150/cccccc',
'large': 'http://placehold.it/500x500/cccccc'
};
$scope.pics.z = {
'small': 'http://placehold.it/150x150/ffffff',
'large': 'http://placehold.it/500x500/ffffff'
};
$scope.currentView = $scope.pics.x.large;
$scope.updateLargeView = function(largePicUriString){
$scope.currentView = largePicUriString;
}
});
CSS Styles
* {
padding: 0;
margin: 0;
}
.wrapper {
width: 500px;
}
.primary,
.secondary {
display: block
}
.primary > img {
width: 100%;
}
.secondary > img {
width: 33%;
}
Jade markup
main(ng-app="sample", ng-controller="sampleCtrl", class="wrapper")
.primary
img(ng-src="{{ currentView }} ")
.secondary
img(ng-repeat="pic in pics", ng-click="updateLargeView(pic.large)" ng-src="{{ pic.small}}")
Here's what it looks like now:
http://codepen.io/uniqueusername/pen/randomlink