hide/show triggered by left click |
Post Reply |
Author | |
Typhoon_121
Newbie Joined: Jan 24 2017 Location: Poland Status: Offline Points: 8 |
Post Options
Thanks(0)
Posted: Apr 02 2018 at 8:47pm |
Hi, I am facing
a problem to get an interaction between two elements. I have created a single-line
text and group of elements. My intention is to hide/show the group of elements
by clicking on a single-line object. I reviewed the forum and as I understand I
should add a Code Block type Javascript and position Header. I implemented
below code however it doesn’t work… Thanks in
advance for any help.
$('#ID_Text_Element').click(function(){
$('#ID_Group_Of_Elements').css('visibility', visible ? 'visible' :
'hidden'); }); |
|
Dmit OE
Admin Group Joined: May 31 2012 Status: Offline Points: 5283 |
Post Options
Thanks(0)
|
Hi,
Try: $(function(){ // to only run after page structure is loaded $('#IDtextelement').click(function(){ $('#IDgroup').css('visibility', $('#IDgroup').is(':visible') ? 'hidden' : 'visible'); }); }); |
|
Typhoon_121
Newbie Joined: Jan 24 2017 Location: Poland Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Hi, This is partial
solution to my problem. It only hides the group of elements, however after I
click on it second time, group of elements doesn’t reappear. |
|
Dmit OE
Admin Group Joined: May 31 2012 Status: Offline Points: 5283 |
Post Options
Thanks(1)
|
$(function(){ // to only run after page structure is loaded
$('#IDtextelement').click(function(){ $('#IDgroup').css('visibility', $('#IDgroup').is(':visible') && ($('#IDgroup').css('visibility') == 'visible') ? 'hidden' : 'visible'); }); }); |
|
Typhoon_121
Newbie Joined: Jan 24 2017 Location: Poland Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Thank you for prompt response! It works as it should
|
|
Typhoon_121
Newbie Joined: Jan 24 2017 Location: Poland Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Hi, I have a
problem when implementing analogical solution in second web page. It seems the
code in first page interferes somehow with code in second, causing the code not
working in second page. Does anyone have an idea how to face it? |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |