I am building a custom theme for koken based on their Blueprint framework theme and have coded it so the album template loops over all images in the album and outputs the images into a 4 column masonry-like grid using CSS, and a jquery script so that when I hover over an image it changes the opacity of all other images in the grid to 0.4.
The jquery code with the grid works fine in JSFiddle, but when I bring it into the koken theme, whenever an image is hovered, the script works for a second showing all but the hovered image at reduced opacity, but then hiding all the images except for the hovered image and the first column.
The code used for the grid is as follows:
HTML
<main>
<div id="grid">
<ul>
<li>
<img src="http://placekitten.com/300/200" class="gridimg" />
</li>
<li>
<img src="http://placekitten.com/300/200" class="gridimg" />
</li>
<li>
<img src="http://placekitten.com/300/200" class="gridimg" />
</li>
<li>
<img src="http://placekitten.com/300/200" class="gridimg" />
</li>
<li>
<img src="http://placekitten.com/300/200" class="gridimg" />
</li>
<li>
<img src="http://placekitten.com/300/200" class="gridimg" />
</li>
<li>
<img src="http://placekitten.com/300/200" class="gridimg" />
</li>
<li>
<img src="http://placekitten.com/300/200" class="gridimg" />
</li>
<li>
<img src="http://placekitten.com/300/200" class="gridimg" />
</li>
</ul>
</div>
CSS
#grid {
/* Prevent vertical gaps */
line-height: 0;
-webkit-column-count: 4;
-webkit-column-gap: 0;
-moz-column-count: 4;
-moz-column-gap: 0;
column-count: 4;
column-gap: 0;
}
#grid img {
/* Just in case there are inline attributes */
width: 100% !important;
height: auto !important;
}
#grid ul li {
display: inline;
}
.gridimg {
opacity:1;
transition: opacity 0.5s;
}
.opaque {
opacity:0.4;
transition: opacity 0.5s;
}
JS
$('img.gridimg').hover(function () {
$('img.gridimg').not(this).each(function () {
$(this).toggleClass("opaque");
});
});
JSFiddle is here: http://jsfiddle.net/jgYY9/3/
Is there something in the koken code that is messing this up? And does anyone know how I can fix it?
Thanks.