Solved

Vertical Scroll with Links

Posted on 2014-10-08
9
156 Views
Last Modified: 2014-11-16
Hi, I've attached an image for reference.

In the image you will see that this is going to be a "Veritcally Scrolling Container" - Currently there are no arrows to go between each item, but we can add them in if necessary.

On the left side you see a few links - "Collections Management", "Reporting and Benchmarking", "Charge Capture", "Coding and Compliance" and "Claims Management".

Currently, the screenshot shows what happens if "Charge Capture" were to be clicked. If someone should click on "Collections Management", it should jump to that and show the appropriate content.

If we were to setup arrows, the arrows would simply just jump between links.

I am trying to find an example of how to do this, and I cannot seem to find anything. Any help on this would be great. I have a deadline for the morning on this and I am stumped.

Thank you in advance.
Screen-Shot-2014-10-08-at-4.08.25-PM.png
0
Comment
Question by:Lanmarkian
  • 4
  • 3
9 Comments
 

Author Comment

by:Lanmarkian
Comment Utility
Also, there are more links so when it scrolls it has to show more that are hidden.
0
 
LVL 51

Expert Comment

by:Julian Hansen
Comment Utility
Must the selected link be in the centre always - what happens when you get to the last / first link

Is the section on the right linked to that on the left or does it scroll independently

From what you have told us I understand you want your navigation on the right to scroll so that the select item is in the center - to get to other items top and bottom either would require arrows or sensing the mouse at the top bottom of the container?
0
 

Author Comment

by:Lanmarkian
Comment Utility
We could just have the navigation scroll. When it gets to the top or the bottom, then it will stop and they can either only go up or down.

The item clicked can stay where it is if need be, but we need at least the content to stay where it is, in the center.

Similar to this: http://www.impressivewebs.com/demo-files/vertical-news-slider/

But I would need the nav on the left to scroll. In fact if the nav on this could scroll, that would be great.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 51

Accepted Solution

by:
Julian Hansen earned 500 total points
Comment Utility
How about this
<!doctype html>
<html>
<head>
<title>Test</title>
<style type="text/css">
* {
  padding: 0;
  margin: 0;
}
.box {
  box-sizing: border-box;
}
html, body {
  height: 100%;
}
body {
  font-size: 100%;
}
#wrapper {
  width: 90%;
  margin: 0 auto;
  min-height: 100%;
  overflow: hidden;
  background: lightgray;
}
nav {
  position: fixed;
  width: 15%;
  height: 100%;
  background: #1f2be6;
  overflow: hidden;
}
nav ul {
  list-style: none;
  width: 100%;
  position: absolute;
  top: 0;
}
nav ul li {
  display: inline-block;
  line-height: 100%;
  padding: 0 2em;
  font-size: 22px;
  width: 100%;
}
nav ul li.selected, nav ul li:hover {
  background: #5f6bff;
}
#viewpane {
  width: 85%;
  padding: 2em;
  min-height: 100%;
  margin-left: 15%;
}
</style>
</head>
<body>
<div id="wrapper">
  <nav>
    <ul class="box">
      <li><a href="#page1">Page 1</a></li>
      <li><a href="#page2">Page 2</a></li>
      <li><a href="#page3">Page 3</a></li>
      <li><a href="#page4">Page 4</a></li>
      <li><a href="#page5">Page 5</a></li>
      <li><a href="#page6">Page 6</a></li>
      <li><a href="#page7">Page 7</a></li>
      <li><a href="#page8">Page 8</a></li>
      <li><a href="#page9">Page 9</a></li>
      <li><a href="#page10">Page 10</a></li>
    </ul>
  </nav><div id="viewpane" class="box">
  </div>
</div>
<script src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
$(function() {
  // SET THE NUMBER OF ITEMS IN THE LIST HERE - 
  // THE REST SHOULD AUTOCONFIGURE
  var listitems = 5;
  var totalitems = $('nav ul li').length;
  var median = (listitems - 1) >> 1;
  $('nav ul li:eq(' + median +')').addClass('selected');
  var height = $('#wrapper').height() / listitems;
  $('nav ul li').css({lineHeight : height + 'px'}).height( $('#wrapper').height() / listitems);
  $('nav li').click(function(e) {
    e.preventDefault();
    var current = $(this);
    var offset = Math.max(current.index() - median, 0);
    offset = Math.min(offset, totalitems - listitems);
    $('li.selected').removeClass('selected');
    $('nav ul').animate({
      top: (height * -offset) 
    },750, function() {
      current.addClass('selected');
    });
  });
});
</script>
</body>
</html>

Open in new window

Working sample here http://www.marcorpsa.com/ee/e014.html
0
 

Author Comment

by:Lanmarkian
Comment Utility
I've requested that this question be closed as follows:

Accepted answer: 0 points for Lanmarkian's comment #a40370593

for the following reason:

test
0
 
LVL 51

Expert Comment

by:Julian Hansen
Comment Utility
Please advise why you are closing this question accepting your own answer?

I believe a valid answer was provided?
0
 
LVL 51

Expert Comment

by:Julian Hansen
Comment Utility
As I am the only expert who answered here is my input.

The question was answered as asked and working code was provided.

No follow up to my last post was made.

Author closing comment does not make sense.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now