Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Как сделать так, чтобы кнопки не закрывали контент jQuery (https://javascript.ru/forum/jquery/79018-kak-sdelat-tak-chtoby-knopki-ne-zakryvali-kontent-jquery.html)

kotkotan 07.12.2019 13:22

Как сделать так, чтобы кнопки не закрывали контент jQuery
 
Помогите пожалуйста сделать кнопки на сайте (три серые кнопки Visible, GSNDVI и Thermal) так, чтобы они не закрывались при нажатии, чтобы можно было только переключаться между ними и соответствующее окно всегда было бы открытым

Мой код

<script type="text/javascript">
jQuery(document).ready(function() {
// Hide the div
// jQuery('#reveal').hide();
jQuery('.rv_button1').click(function(e){
e.preventDefault();
jQuery("#reveal1").fadeToggle();
// Hide the div
jQuery('#reveal2').hide();
jQuery('#reveal3').hide();
jQuery('#reveal4').hide();
jQuery('#reveal5').hide();
jQuery('.rv_button1').toggleClass('opened closed');
});
});
</script>

<script type="text/javascript">
jQuery(document).ready(function() {
// Hide the div
jQuery('#reveal2').hide();
jQuery('.rv_button2').click(function(e){
e.preventDefault();
jQuery("#reveal2").fadeToggle();
// Hide the div
jQuery('#reveal1').hide();
jQuery('#reveal3').hide();
jQuery('#reveal4').hide();
jQuery('#reveal5').hide();
jQuery('.rv_button2').toggleClass('opened closed');
});
});
</script>

<script type="text/javascript">
jQuery(document).ready(function() {
// Hide the div
jQuery('#reveal3').hide();
jQuery('.rv_button3').click(function(e){
e.preventDefault();
jQuery("#reveal3").fadeToggle();
// Hide the div
jQuery('#reveal1').hide();
jQuery('#reveal2').hide();
jQuery('#reveal4').hide();
jQuery('#reveal5').hide();
jQuery('.rv_button3').toggleClass('opened closed');
});
});
</script>

<script type="text/javascript">
jQuery(document).ready(function() {
// Hide the div
jQuery('#reveal4').hide();
jQuery('.rv_button4').click(function(e){
e.preventDefault();
jQuery("#reveal4").slideToggle();
// Hide the div
jQuery('#reveal1').hide();
jQuery('#reveal2').hide();
jQuery('#reveal3').hide();
jQuery('#reveal5').hide();
jQuery('.rv_button4').toggleClass('opened closed');
});
});
</script>

<script type="text/javascript">
jQuery(document).ready(function() {
// Hide the div
jQuery('#reveal5').hide();
jQuery('.rv_button5').click(function(e){
e.preventDefault();
jQuery("#reveal5").slideToggle();
// Hide the div
jQuery('#reveal1').hide();
jQuery('#reveal2').hide();
jQuery('#reveal3').hide();
jQuery('#reveal4').hide();
jQuery('.rv_button5').toggleClass('opened closed');
});
});
</script>

рони 07.12.2019 13:43

Цитата:

Сообщение от kotkotan
так, чтобы они не закрывались при нажатии, чтобы можно было только переключаться между ними и соответствующее окно всегда было бы открытым

не осилил, но наверняка вам нужна открывашка искать по форуму, есть сотни примеров!!!

kotkotan 07.12.2019 14:00

Цитата:

Сообщение от рони (Сообщение 516930)
не осилил, но наверняка вам нужна открывашка искать по форуму, есть сотни примеров!!!

сейчас работает по принципу: открывает и закрывает окно при нажатии, а надо чтобы только открывало. любое из 3 окон только открывало.

рони 07.12.2019 14:20

kotkotan,
http://javascript.ru/forum/showthrea...791#post350014
https://javascript.ru/forum/jquery/7...tml#post491304

https://javascript.ru/forum/dom-wind...tml#post477806

рони 07.12.2019 14:22

kotkotan,
https://javascript.ru/forum/misc/640...tml#post422511

kotkotan 08.12.2019 19:07

спасибо, я вижу, что в ссылках есть, то что мне нужно, но я не смогу поправить свой код в соответствии, ибо не понятно. меня интересует одна, единственная правка для нужной функциональности.
все-равно спасибо)

рони 08.12.2019 20:43

kotkotan,
сделайте минимальную структуру ваших блоков, только основное, минимум текста, только html и css, желательно без id, на классах.


Часовой пояс GMT +3, время: 11:42.