Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
15403 manish.sha 1
$(document).ready(function(){/* copy loaded thumbnails into carousel */
2
$('.row .thumbnail').on('load', function() {
3
 
4
}).each(function(i) {
5
  if(this.complete) {
6
  	var item = $('<div class="item"></div>');
7
    var itemDiv = $(this).parents('div');
8
    var title = $(this).parent('a').attr("title");
9
    item.attr("title",title.substr(0,45));
10
  	$(itemDiv.html()).appendTo(item);
11
  	item.appendTo('.carousel-inner'); 
12
    $('.carousel-inner div:last-child').find('a',0).find('img',0).attr('src',$(this).data('url'));
13
    if (i==0){ // set first item active
14
      item.addClass('active');
15
    }
16
  }
17
});
18
 
19
/* activate the carousel */
20
$('#modalCarousel').carousel({interval:false});
21
 
22
/* change modal title when slide changes */
23
$('#modalCarousel').on('slid.bs.carousel', function () {
24
  $('.modal-title').html($(this).find('.active').attr("title"));
25
})
26
 
27
/* when clicking a thumbnail */
28
$('.row .thumbnail').click(function(){
29
    var idx = $(this).parents('div').index();
30
  	var id = parseInt(idx);
31
  	$('#myModal').modal('show'); // show the modal
32
    $('#modalCarousel').carousel(id); // slide carousel to selected  	
33
});
34
 
35
});