Print Page | Close Window

hide/show triggered by left click

Printed From: openElement Website
Category:

openElement


Forum Name: User Tutorials
Forum Description: Browse or create a tutorial to get the most out of the openElement software.
Please do not post support questions in this section.
URL: https://forums.openelement.uk/en/forum_posts.asp?TID=1347
Printed Date: Apr 16 2024 at 9:34am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: hide/show triggered by left click
Posted By: Typhoon_121
Subject: hide/show triggered by left click
Date 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');

   });




Replies:
Posted By: Dmit OE
Date Posted: Apr 02 2018 at 9:28pm
Hi,

Try:

$(function(){ // to only run after page structure is loaded

$('#IDtextelement').click(function(){
$('#IDgroup').css('visibility', $('#IDgroup').is(':visible') ? 'hidden' : 'visible');
});

});


Posted By: Typhoon_121
Date Posted: Apr 03 2018 at 10:29pm

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.



Posted By: Dmit OE
Date Posted: Apr 03 2018 at 10:33pm
$(function(){ // to only run after page structure is loaded

$('#IDtextelement').click(function(){
$('#IDgroup').css('visibility', $('#IDgroup').is(':visible') && ($('#IDgroup').css('visibility') == 'visible') ? 'hidden' : 'visible');
});

});


Posted By: Typhoon_121
Date Posted: Apr 03 2018 at 11:27pm
Thank you for prompt response! It works as it should Smile


Posted By: Typhoon_121
Date Posted: Apr 23 2018 at 11:38am

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?





Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net