Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $( document ).on('turbolinks:load', function() {
- /*************************** centre *******************************************/
- /* copy loaded thumbnails into carousel */
- $('#gallery_centre .row .thumbnail').on('load', function() {
- }).each(function(i) {
- if(this.complete) {
- var item_centre = $('<div class="item item_centre"></div>');
- var itemDiv_centre = $(this).parents('div');
- $(itemDiv_centre.html()).appendTo(item_centre);
- item_centre.appendTo('.carousel-inner_centre');
- if (i==0){ // set first item active
- item_centre.addClass('active');
- }
- }
- });
- /* activate the carousel */
- $('#modalCarouselCentre').carousel({interval:false});
- /* change modal title when slide changes */
- $('#modalCarouselCentre').on('slid.bs.carousel', function () {
- $('.modal-title').html($(this).find('.active').attr("title"));
- })
- /* when clicking a thumbnail */
- $('#gallery_centre .row .thumbnail').click(function(){
- var idx_centre = $(this).parents('div').index();
- var id_centre = parseInt(idx_centre);
- $('#myModalCentre').modal('show'); // show the modal
- $('#modalCarouselCentre').carousel(id_centre); // slide carousel to selected
- });
- /***************************** Coeur *****************************************/
- /* copy loaded thumbnails into carousel */
- $('#gallery_coeur .row .thumbnail').on('load', function() {
- }).each(function(i) {
- if(this.complete) {
- var item_coeur = $('<div class="item item_coeur"></div>');
- var itemDiv_coeur = $(this).parents('div');
- $(itemDiv_coeur.html()).appendTo(item_coeur);
- item_coeur.appendTo('.carousel-inner_coeur');
- if (i==0){ // set first item active
- item_coeur.addClass('active');
- }
- }
- });
- /* activate the carousel */
- $('#modalCarouselCoeur').carousel({interval:false});
- /* change modal title when slide changes */
- $('#modalCarouselCoeur').on('slid.bs.carousel', function () {
- $('.modal-title').html($(this).find('.active').attr("title"));
- })
- /* when clicking a thumbnail */
- $('#gallery_coeur .row .thumbnail').click(function(){
- var idx_coeur = $(this).parents('div').index();
- var id_coeur = parseInt(idx_coeur);
- $('#myModalCoeur').modal('show'); // show the modal
- $('#modalCarouselCoeur').carousel(id_coeur); // slide carousel to selected
- });
- /*************************** Deloc *******************************************/
- /* copy loaded thumbnails into carousel */
- $('#gallery_deloc .row .thumbnail').on('load', function() {
- }).each(function(i) {
- if(this.complete) {
- var item_deloc = $('<div class="item item_deloc"></div>');
- var itemDiv_deloc = $(this).parents('div');
- $(itemDiv_deloc.html()).appendTo(item_deloc);
- item_deloc.appendTo('.carousel-inner_deloc');
- if (i==0){ // set first item active
- item_deloc.addClass('active');
- }
- }
- });
- /* activate the carousel */
- $('#modalCarouselDeloc').carousel({interval:false});
- /* change modal title when slide changes */
- $('#modalCarouselDeloc').on('slid.bs.carousel', function () {
- $('.modal-title').html($(this).find('.active').attr("title"));
- })
- /* when clicking a thumbnail */
- $('#gallery_deloc .row .thumbnail').click(function(){
- var idx_deloc = $(this).parents('div').index();
- var id_deloc = parseInt(idx_deloc);
- $('#myModalDeloc').modal('show'); // show the modal
- $('#modalCarouselDeloc').carousel(id_deloc); // slide carousel to selected
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement