MindMap

Mindmap used as navi to bullet list

by Jeff Barclay

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
<script src="https://jeffbarclay.com/mindmap/raphael-min.js"></script>
<ul>
    <li><a href="http://jeffbarcay.com/">ALS</a>
      <ul>
        <li><a href="#" target="_blank" class="alert" style="background:green !important;">Chest Pain</a></li>
        <li><a href="#" target="_blank" class="icon linkedin" color="blue">Shortness of Breath</a></li>
        <li><a href="#" target="_blank" class="icon facebook">Allergic Reaction</a></li>
        <li><a href="http://www.google.com" target="_blank" class="icon twitter" title="goo">Diabetic</a></li>
        <li><a href="#">STEMI</a>
          <ul>
          	<li><a href="#" target="_blank" class="icon twitter" title="9">ACS</a></li> 
          	<li><a href="#" target="_blank" class="closebtn" title="13">STEMI</a>
          	  <ul>
          		<li><a href="#" title="A">Treatment</a></li> 
          		<li><a href="#" title="C">Protocol</a></li> 
          	  </ul>
          	</li> 
          </ul>
        </li>
    
        
  		</ul>
    </li>
  </ul>
  
  
  <div class="alert">
  <span class="closebtn" onclick="this.parentElement.style.display='none';">&times;</span> 
  	<ul>
  		<li>one</li>
  		<li>two</li>
  		<li>three</li>
  	</ul>
  </div>

CSS

body {
    background:blue;
}

.js-mindmap-active a.node {
    background:gray;
    border: 2px solid white;
    -webkit-border-top-left-radius: 20px;
    -webkit-border-bottom-right-radius: 20px;
    -moz-border-radius-topleft: 20px;
    -moz-border-radius-bottomright: 20px;
    border-top-left-radius: 20px;
    border-bottom-right-radius: 20px;    
}
.js-mindmap-active a.node.active {
    padding:5px 10px !important;
    border-width:5px !important;
}
.js-mindmap-active a.node.activeparent {
    padding:5px 10px !important;
    border-width:5px !important;
    background:#8B0000;
}


/*
.js-mindmap-active a.node {
background:red;
border: 2px solid white;
-webkit-border-radius: 60px;
-moz-border-radius: 60px;
border-radius: 60px;
width: 120px;
height: 60px;
padding: 30px 0px;
text-align:center;
}
.js-mindmap-active a.node.active {
border-width:5px !important;
}
.js-mindmap-active a.node.activeparent {
border-width:5px !important;
background:#8B0000;
}

*/
.js-mindmap-active .node.orange {
  background:#f89a3a; 
}
.js-mindmap-active .node.green {
  background:#92c63d; 
}
.js-mindmap-active .node.blue {
  background:#4688c2; 
}
.js-mindmap-active .node.purple {
  background:#6b5ba6; 
}
.js-mindmap-active .node.red {
  background:#c64d44; 
}

.alert {
   		padding: 20px;
   		background-color: #f44336;
   		color: black;
	}

	.closebtn {
   		margin-left: 15px;
   		color: white;
   		font-weight: bold;
   		float: right;
   		font-size: 22px;
   		line-height: 20px;
   		cursor: pointer;
   		transition: 0.3s;
	}

	.closebtn:hover {
   		color: black;
	}

JavaScript

/*
 js-mindmap
 
 Copyright (c) 2008/09/10 Kenneth Kufluk http://kenneth.kufluk.com/
 
 MIT (X11) license
  
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:

 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.

*/

/*
    Things to do:
        - remove Lines - NO - they seem harmless enough!
        - add better "make active" methods
        - remove the "root node" concept.  Tie nodes to elements better, so we can check if a parent element is root

        - allow progressive exploration
            - allow easy supplying of an ajax param for loading new kids and a loader anim
        - allow easy exploration of a ul or ol to find nodes
        - limit to an area
        - allow more content (div instead of an a)
        - test multiple canvases
        - Hidden children should not be bounded
        - Layout children in circles
        - Add/Edit nodes
        - Resize event
        - incorporate widths into the forces, so left boundaries push on right boundaries


    Make demos:
        - amazon explore
        - directgov explore
        -...