SiberianGuy
SiberianGuy

Reputation: 25292

jQuery gallery which supports photos selection

I need a simple jQuery photo gallery (just a table of images) which supports photos selection by mouse click (e. g. by border color/width change). Is there any?

Upvotes: 0

Views: 78

Answers (1)

Pastor Bones
Pastor Bones

Reputation: 7351

That would be rather easy to build, why do you need a gallery? Here's a rather rudimentary example of how it "could" be done (also shown here in JsFiddle)

HTML

<table id="gallery">
  <tr></tr>
</table>

Jquery

$(function(){
  var imgs = array('img1.png', 'img2.png', 'img3.png', 'img4.png', 'img5.png', 'img6.png')
    , img_per_col = 3
    , img_cnt = 0
    , html = '<tr>';

  $.each(imgs, function(img){
    html += '<td><img src="' + img + '" /></td>';
    img_cnt++;
    if(img_cnt == img_per_col) {
      html += '</tr><tr>';
      img_per_col = 0;
    }
  });
  html += '</tr>';
  $('table#gallery').html(html);
});

Upvotes: 1

Related Questions