A
A
Andrey Reshetov2018-03-06 12:19:26
JavaScript
Andrey Reshetov, 2018-03-06 12:19:26

How to display content in a dialog box depending on the button from which it opens?

I have a slider, it has several buttons with pictures and one dialog box. It is necessary to display the content in the window when clicked, depending on the image and the button. Can this be done via javascript and how? Or is it necessary for each button to have its own window? Help plz)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima, 2018-03-06
@Renzi0n

можно сделать)  я использую модалки бутстрапа. 
в слайдере так

<code lang="html">
<button id="con1" onclick="open1()">вызов первого  контента</button>
</code>
<code lang="javascript">
function open1(){
тут функция вызова модалки;

тут применение стилей display:block; к элементу с классом content_1;
}
</code>
modal should look like this:
<style>
[class^="content_"] {
display: none;
}
</style>

<div class="content_1">bla bla bla</div>
<div class="content_2">bla bla bla</div>
<div class="content_3">bla bla bla</div>
<div class="content_4">bla bla bla</div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question