Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Javascript CSS: click on left panel header opens right panel

Posted on 2016-11-03
4
Medium Priority
?
282 Views
Last Modified: 2016-11-06
I have a left panel of headers, that look like of like menu items. That is done.

I have a right panel. I want to be able to click on the left header and have a panel on the right appear.
If I click on another header, the panel on the right disappears and a different panel on the right appears, and so forth.

So how can I click a header on the left, and have it show the content on the right, and then another header hides all content on the right (not knowing what one was showing) and then shows the selected content on the right.

I don't want a slide out.
I looked at code and it shows panels where you click a plus symbol and the content within the same DIV group below it shows and hides. But I don't want it anywhere near each other on the page.

How do I do what I described?

thanks!
0
Comment
Question by:Starr Duskk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 59

Expert Comment

by:Julian Hansen
ID: 41872967
What you want is fairly straightforward but I need to understand if you are not going to do a slide out how is the content on the right going to be structured? Where is the content that not visible going to go and how is the transition from current to next going to happen?

You will probably need JavaScript for this. It is possible to have adjacent panels hide and show using a hidden checkbox and CSS but your layout might preclude such an arrangement which will leave you with JS.

A click event handler on the class of the left links can be used to hide all right panels and activate the one linked to the header clicked. You can use classes and custom attributes to link left to right so for instance
Left Links
<li><a href="#rightpanelID1" class="left-panel-link">Left 1</a></li>

Open in new window


<div class="right-panel-link id="rightPanelID1">Linked to Left 1</div>

Open in new window

jQuery
<script src="http://code.jquery.com/jquery.js"></script>
<script>
$(function() {
   $('.left-panel-link').click(function(e) {
      e.preventDefault();
      $('.right-panel-links').hide();
      $($(this).attr('href')).show();
   });
});

Open in new window


This is not working code - you would need to adapt to your specific requirement but it outlines the general principle.

If you can give us some indication as to how the right is going to work I can knock together a sample.
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 41873268
what do you think about the following ?
https://jqueryui.com/tabs/
0
 
LVL 2

Author Comment

by:Starr Duskk
ID: 41876280
leakim971,
This is perfect!!! I selected the vertical one and it is exactly what I need!
https://jqueryui.com/tabs/#vertical
thanks so much! I really don't understand what it is doing and can't see clearly how it is hiding and showing, I assume all that code is in the widget somewhere. I'll read more on that.
thanks so much!
1
 
LVL 2

Author Comment

by:Starr Duskk
ID: 41876281
Julian, thanks for taking the time to respond as well.
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question