I have ".help" divs.
Inside the help divs is a span of class title & a span of class info
within info can be sub help divs with even more information.
The entire hierarchy is fully collapsed, and I want to know how I can make it so that I can click on the div and cause it to open up the info portion (because the title is already shown)
I was able to make it so that I can click on the spans and those will open up their sibling element of class info. But I can't get it to work for the parent without it expanding everything.
here is the code I have working for sibling to sibling
- $(document).ready(function() {
- $('.info').hide();
- $(".help i").each(function (){
- $(this).html('<span class="switch">'+$(this).html()+'</span>');
- //$(this).append(',');
- });
- $(".switch").click(showHideInfo);
- $("#startButton").click(developBoard);
- });
- function showHideInfo(){
- var infoBox=$(this).parent().siblings();
- if (infoBox.css("display")=="none")
- {
- infoBox.show(100);
- $(this).css("text-decoration","underline");
- }
- else
- {
- infoBox.hide(100);
- $(this).css("text-decoration","none");
- }
- //$('.info',$(this).parent()).show();
- }
- function developBoard(){
- var boardWidth ;
- var boardHeight;
- }
- // the player, creatures, items and blocks are all entities
- function entity(){
- this.strength = 0;
- this.weight = 0;
- this.gravity=1;
- }