javascript - loading a specific slide in carousel in modal in bootstrap -


I have a list of thumbnails, while clicking on them on Bootstrap 3 page, I want to open a model that contains each Additional info for the thumbnail is the carousel.

I think that when I click on the thumbnail, the window opens with a specific slide in opening.

I am trying the following, but use the "data-target" to set the "Data-Slide-to" attribute goal of the "Data Toggle" and Carousel of both models, but this In the case, the targets are two different IDs ("#mymodal" and "#gallery" estimated). I can not have a "data-target" on the same HTML tag Is this a way to hack easily? Sorry, I'm not a god.

This is the list of thumbnails:

  & lt; Div class = "container" & gt; & Lt; Div class = "row" & gt; & Lt; Div class = "colonel-xs-6 call-sh-4 column-md-3" & gt; & Lt; IMG src = "http://placehold.it/150x75&text=item1" data-toggle = "modal" data-target = "#mymodel" data-slide-to = "0" & ​​gt; & Lt; / Div & gt; & Lt; Div class = "col-xs-6 col-sm-4 col-md-3" & gt; & Lt; Img src = "http://placehold.it/150x75&text=item2" data-toggle = "modal" data-target = "#mymodel" data-slide-to = "1" & gt; & Lt; / Div & gt; & Lt; Div class = "colonel-xs-6 call-sh-4 column-md-3" & gt; & Lt; IMG src = "http://placehold.it/150x75&text=item3" data-toggle = "modal" data-target = "#mymodel" data-slide-to = "2" & gt; & Lt; / Div & gt; & Lt; Div class = "colonel-xs-6 col-sm-4 col-md-3" & gt; & Lt; Img src = "http://placehold.it/150x75&text=item4" data-toggle = "modal" data-target = "#mymodel" data-slide-to = "3" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

And here is the model code:

  & lt; Div class = "modal fade" id = "mymodal" tabindex = "- 1" role = "dialog" aria-labelledby = "myModalLabel" aria-hidden = "true" & gt; & Lt; Div class = "modal-dialog" & gt; & Lt; Div class = "modal-content" & gt; & Lt; Div class = "modal-header" & gt; & Gt; Button type = "button" class = "off" data-discarded = "model" & gt; & Lt; Span aria-hidden = "true" & gt; & Amp; Times; & Lt; / Span & gt; & Lt; Span class = "sr-only" & gt; Close & lt; / Span & gt; & Lt; / Button & gt; & Lt; / Div & gt; & Lt; Div class = "modal-body" & gt; & Lt; Div id = "gallery" square = "carousel slide" data-interval = "wrong" & gt; & Lt; Div class = "carousel-interior" & gt; & Lt; Div class = "item active" & gt; & Lt; Img src = "http://placehold.it/600x400&text=item1" alt = "item1" & gt; & Lt; Div class = "carousel-caption" & gt; & Lt; H4 & gt; Title 1 & lt; / H4 & gt; & Lt; P & gt; This is the description. & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "item" & gt; & Lt; Img src = "http://placehold.it/600x400&text=item2" alt = "item2" & gt; & Lt; Div class = "carousel-caption" & gt; & Lt; H4 & gt; Title 2 & lt; / H4 & gt; & Lt; P & gt; This is the description. & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "item" & gt; & Lt; Img src = "http://placehold.it/600x400&text=item3" alt = "item3" & gt; & Lt; Div class = "carousel-caption" & gt; & Lt; H4 & gt; Title 3 & lt; / H4 & gt; & Lt; P & gt; This is the description. & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "item" & gt; & Lt; Img src = "http://placehold.it/600x400&text=item4" alt = "item4" & gt; & Lt; Div class = "carousel-caption" & gt; & Lt; H4 & gt; Title 4 & lt; / H4 & gt; & Lt; P & gt; This is the description. & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; One class = "left the goose control" href = "# gallery" roll = "button" data-slide = "back" & gt; & Lt; Span class = "glyphicon glyphicon-chevron-left" & gt; & Lt; / Span & gt; & Lt; / A & gt; & Lt; A class = "right carousel-control" href = "# gallery" role = "button" data-slide = "next" & gt; & Lt; Span category = "glyphin glyphine-chevron-right" & gt; & Lt; / Span & gt; & Lt; / A & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;    

You can wrap the image in anchor which targets this kind of carousel Is:

Demo:

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -