BullGuard Antivirus Sale - 60% Off with openElement !
openElement Website Homepage
Forum Home Forum Home >

openElement

> User Tutorials
  New Posts New Posts RSS Feed - hide/show triggered by left click
  FAQ FAQ  Forum Search   Register Register  Login Login

hide/show triggered by left click

 Post Reply Post Reply
Author
Message
Typhoon_121 View Drop Down
Newbie
Newbie
Avatar

Joined: Jan 24 2017
Location: Poland
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote Typhoon_121 Quote  Post ReplyReply Direct Link To This Post Topic: hide/show triggered by left click
    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');

   });

Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group
Avatar

Joined: May 31 2012
Status: Offline
Points: 5266
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post 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');
});

});
Back to Top
Typhoon_121 View Drop Down
Newbie
Newbie
Avatar

Joined: Jan 24 2017
Location: Poland
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote Typhoon_121 Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group
Avatar

Joined: May 31 2012
Status: Offline
Points: 5266
Post Options Post Options   Thanks (1) Thanks(1)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post 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');
});

});
Back to Top
Typhoon_121 View Drop Down
Newbie
Newbie
Avatar

Joined: Jan 24 2017
Location: Poland
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote Typhoon_121 Quote  Post ReplyReply Direct Link To This Post Posted: Apr 03 2018 at 11:27pm
Thank you for prompt response! It works as it should Smile
Back to Top
Typhoon_121 View Drop Down
Newbie
Newbie
Avatar

Joined: Jan 24 2017
Location: Poland
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote Typhoon_121 Quote  Post ReplyReply Direct Link To This Post 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?


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 10.11
Copyright ©2001-2012 Web Wiz Ltd.

This page was generated in 0,047 seconds.