Team:Wageningen UR/Templates/test NavigationTop

From 2011.igem.org

(Difference between revisions)
(Created page with "<html> <head> <script type="text/javascript" src="specify script file URL here"> /* Script by: www.jtricks.com * Version: 1.7 (20110408) * Latest version: www.jtricks.co...")
 
(8 intermediate revisions not shown)
Line 1: Line 1:
<html>
<html>
<head>
<head>
-
    <script type="text/javascript" src="specify script file URL here">
+
<style>
-
/* Script by: www.jtricks.com
+
     body {
-
* Version: 1.7 (20110408)
+
         background-color:#000;
-
* Latest version: www.jtricks.com/javascript/navigation/floating.html
+
         height:2000px;
-
*/
+
         color:#ccc;
-
var floatingMenu =
+
         font:10px "Lucida Grande", "Lucida Sans", "Trebuchet MS", verdana, sans-serif;
-
{
+
     }
-
     hasInner: typeof(window.innerWidth) == 'number',
+
     #floatMenu {   
-
    hasElement: typeof(document.documentElement) == 'object'
+
         position:absolute;  
-
        && typeof(document.documentElement.clientWidth) == 'number'
+
         top:150px;
-
};
+
         left:50%;
-
 
+
         margin-left:235px;
-
var floatingArray =
+
         width:200px;
-
[
+
     }
-
];
+
     #floatMenu ul {
-
 
+
         margin-bottom:20px;
-
floatingMenu.add = function(obj, options)
+
     }
-
{
+
     #floatMenu ul li a {
-
    var name;
+
         display:block;
-
    var menu;
+
         border:1px solid #999;
-
 
+
         background-color:#222;   
-
    if (typeof(obj) === "string")
+
         border-left:6px solid #999;
-
         name = obj;
+
         text-decoration:none;   
-
    else
+
         color:#ccc;   
-
         menu = obj;
+
         padding:5px 5px 5px 25px;   
-
          
+
-
 
+
-
    if (options == undefined)
+
-
    {
+
-
        floatingArray.push(
+
-
            {
+
-
                id: name,
+
-
                menu: menu,
+
-
 
+
-
                targetLeft: 0,
+
-
                targetTop: 0,
+
-
 
+
-
                distance: .07,
+
-
                snap: true
+
-
            });
+
-
    }
+
-
    else
+
-
    {
+
-
         floatingArray.push(
+
-
            {
+
-
                id: name,
+
-
                menu: menu,
+
-
 
+
-
                targetLeft: options.targetLeft,
+
-
                targetRight: options.targetRight,
+
-
                targetTop: options.targetTop,
+
-
                targetBottom: options.targetBottom,
+
-
 
+
-
                centerX: options.centerX,
+
-
                centerY: options.centerY,
+
-
 
+
-
                prohibitXMovement: options.prohibitXMovement,
+
-
                prohibitYMovement: options.prohibitYMovement,
+
-
 
+
-
                distance: options.distance != undefined ? options.distance : .07,
+
-
                snap: options.snap,
+
-
                ignoreParentDimensions: options.ignoreParentDimensions,
+
-
 
+
-
                scrollContainer: options.scrollContainer,
+
-
                scrollContainerId: options.scrollContainerId
+
-
            });
+
-
     }
+
-
};
+
-
 
+
-
floatingMenu.findSingle = function(item)
+
-
{
+
-
     if (item.id)
+
-
        item.menu = document.getElementById(item.id);
+
-
 
+
-
    if (item.scrollContainerId)
+
-
        item.scrollContainer = document.getElementById(item.scrollContainerId);
+
-
};
+
-
 
+
-
floatingMenu.move = function (item)
+
-
{
+
-
    if (!item.prohibitXMovement)
+
-
    {
+
-
        item.menu.style.left = item.nextX + 'px';
+
-
        item.menu.style.right = '';
+
-
    }
+
-
 
+
-
    if (!item.prohibitYMovement)
+
-
    {
+
-
        item.menu.style.top = item.nextY + 'px';
+
-
        item.menu.style.bottom = '';
+
-
    }
+
-
};
+
-
 
+
-
floatingMenu.scrollLeft = function(item)
+
-
{
+
-
    // If floating within scrollable container use it's scrollLeft
+
-
    if (item.scrollContainer)
+
-
        return item.scrollContainer.scrollLeft;
+
-
 
+
-
    var w = window;
+
-
 
+
-
    // Find top window scroll parameters if we're IFRAMEd
+
-
    while (w != w.parent)
+
-
        w = w.parent;
+
-
 
+
-
    return this.hasInner
+
-
        ? w.pageXOffset  
+
-
         : this.hasElement  
+
-
          ? w.document.documentElement.scrollLeft 
+
-
          : w.document.body.scrollLeft;
+
-
};
+
-
 
+
-
floatingMenu.scrollTop = function(item)
+
-
{
+
-
    // If floating within scrollable container use it's scrollTop
+
-
    if (item.scrollContainer)
+
-
         return item.scrollContainer.scrollTop;
+
-
 
+
-
    var w = window;
+
-
 
+
-
    // Find top window scroll parameters if we're IFRAMEd
+
-
    while (w != w.parent)
+
-
        w = w.parent;
+
-
 
+
-
    return this.hasInner
+
-
        ? w.pageYOffset
+
-
        : this.hasElement
+
-
          ? w.document.documentElement.scrollTop
+
-
          : w.document.body.scrollTop;
+
-
};
+
-
 
+
-
floatingMenu.windowWidth = function()
+
-
{
+
-
    return this.hasElement
+
-
        ? document.documentElement.clientWidth
+
-
         : document.body.clientWidth;
+
-
};
+
-
 
+
-
floatingMenu.windowHeight = function()
+
-
{
+
-
    if (floatingMenu.hasElement && floatingMenu.hasInner)
+
-
    {
+
-
         // Handle Opera 8 problems
+
-
        return document.documentElement.clientHeight > window.innerHeight
+
-
            ? window.innerHeight
+
-
            : document.documentElement.clientHeight
+
-
    }
+
-
    else
+
-
    {
+
-
        return floatingMenu.hasElement
+
-
            ? document.documentElement.clientHeight
+
-
            : document.body.clientHeight;
+
-
    }
+
-
};
+
-
 
+
-
floatingMenu.documentHeight = function()
+
-
{
+
-
    var innerHeight = this.hasInner
+
-
        ? window.innerHeight
+
-
         : 0;
+
-
 
+
-
     var body = document.body,
+
-
        html = document.documentElement;
+
-
 
+
-
    return Math.max(
+
-
        body.scrollHeight,
+
-
        body.offsetHeight,
+
-
        html.clientHeight,
+
-
        html.scrollHeight,
+
-
        html.offsetHeight,
+
-
        innerHeight);
+
-
};
+
-
 
+
-
floatingMenu.documentWidth = function()
+
-
{
+
-
     var innerWidth = this.hasInner
+
-
        ? window.innerWidth
+
-
        : 0;
+
-
 
+
-
    var body = document.body,
+
-
        html = document.documentElement;
+
-
 
+
-
    return Math.max(
+
-
        body.scrollWidth,
+
-
        body.offsetWidth,
+
-
        html.clientWidth,
+
-
        html.scrollWidth,
+
-
        html.offsetWidth,
+
-
        innerWidth);
+
-
};
+
-
 
+
-
floatingMenu.calculateCornerX = function(item)
+
-
{
+
-
    var offsetWidth = item.menu.offsetWidth;
+
-
 
+
-
    if (item.centerX)
+
-
         return this.scrollLeft(item) + (this.windowWidth() - offsetWidth)/2;
+
-
 
+
-
    var result = this.scrollLeft(item) - item.parentLeft;
+
-
    if (item.targetLeft == undefined)
+
-
    {
+
-
        result += this.windowWidth() - item.targetRight - offsetWidth;
+
-
     }
+
-
     else
+
-
    {
+
-
         result += item.targetLeft;
+
-
    }
+
-
          
+
-
    if (document.body != item.menu.parentNode
+
-
        && result + offsetWidth >= item.confinedWidthReserve)
+
-
    {
+
-
        result = item.confinedWidthReserve - offsetWidth;
+
-
    }
+
-
 
+
-
    if (result < 0)
+
-
         result = 0;
+
-
 
+
-
    return result;
+
-
};
+
-
 
+
-
floatingMenu.calculateCornerY = function(item)
+
-
{
+
-
    var offsetHeight = item.menu.offsetHeight;
+
-
 
+
-
    if (item.centerY)
+
-
        return this.scrollTop(item) + (this.windowHeight() - offsetHeight)/2;
+
-
 
+
-
    var result = this.scrollTop(item) - item.parentTop;
+
-
    if (item.targetTop === undefined)
+
-
    {
+
-
        result += this.windowHeight() - item.targetBottom - offsetHeight;
+
-
    }
+
-
    else
+
-
    {
+
-
        result += item.targetTop;
+
-
    }
+
-
 
+
-
    if (document.body != item.menu.parentNode
+
-
        && result + offsetHeight >= item.confinedHeightReserve)
+
-
    {
+
-
        result = item.confinedHeightReserve - offsetHeight;
+
-
    }
+
-
 
+
-
    if (result < 0)
+
-
        result = 0;
+
-
       
+
-
    return result;
+
-
};
+
-
 
+
-
floatingMenu.computeParent = function(item)
+
-
{
+
-
    if (item.ignoreParentDimensions)
+
-
    {
+
-
        item.confinedHeightReserve = this.documentHeight();
+
-
        item.confinedWidthReserver = this.documentWidth();
+
-
        item.parentLeft = 0;   
+
-
         item.parentTop = 0; 
+
-
        return;
+
-
    }
+
-
 
+
-
    var parentNode = item.menu.parentNode;
+
-
    var parentOffsets = this.offsets(parentNode, item);
+
-
    item.parentLeft = parentOffsets.left;
+
-
    item.parentTop = parentOffsets.top;
+
-
 
+
-
    item.confinedWidthReserve = parentNode.clientWidth;
+
-
 
+
-
    // We could have absolutely-positioned DIV wrapped
+
-
    // inside relatively-positioned. Then parent might not
+
-
    // have any height. Try to find parent that has
+
-
    // and try to find whats left of its height for us.
+
-
    var obj = parentNode;
+
-
    var objOffsets = this.offsets(obj, item);
+
-
    while (obj.clientHeight + objOffsets.top
+
-
          < item.menu.offsetHeight + parentOffsets.top)
+
-
    {
+
-
        obj = obj.parentNode;
+
-
        objOffsets = this.offsets(obj, item);
+
-
    }
+
-
 
+
-
    item.confinedHeightReserve = obj.clientHeight
+
-
         - (parentOffsets.top - objOffsets.top);
+
-
};
+
-
 
+
-
floatingMenu.offsets = function(obj, item)
+
-
{
+
-
    var result =
+
-
    {
+
-
        left: 0,
+
-
        top: 0
+
-
    };
+
-
 
+
-
    if (obj === item.scrollContainer)
+
-
        return;
+
-
 
+
-
    while (obj.offsetParent && obj.offsetParent != item.scrollContainer)
+
-
    {  
+
-
         result.left += obj.offsetLeft;   
+
-
         result.top += obj.offsetTop;   
+
-
        obj = obj.offsetParent;
+
     }   
     }   
-
     if (window == window.parent)
+
#floatMenu ul.menu1 li a:hover { 
-
        return result;
+
     border-color:#09f; 
 +
 +
#floatMenu ul.menu2 li a:hover { 
 +
    border-color:#9f0;
 +
 +
#floatMenu ul.menu3 li a:hover { 
 +
    border-color:#f09; 
 +
}
-
    // we're IFRAMEd
+
@charset "UTF-8";
-
    var iframes = window.parent.document.body.getElementsByTagName("IFRAME");
+
/* CSS Document */
-
    for (var i = 0; i < iframes.length; i++)
+
-
    {
+
-
        if (iframes[i].contentWindow != window)
+
-
          continue;
+
-
        obj = iframes[i];
+
#page-wrap{
-
        while (obj.offsetParent) 
+
border-right:1px solid #444;
-
        {
+
border-left:1px solid #444;
-
            result.left += obj.offsetLeft;
+
width:900px;
-
            result.top += obj.offsetTop;
+
margin:0 auto;
-
            obj = obj.offsetParent;
+
background-color:#222;
-
        } 
+
color:#ffffff;
-
    }
+
font-family:"Lucida Grande", "Lucida Sans", "Trebuchet MS", verdana, sans-serif;
-
 
+
}
-
    return result;
+
#page-wrap #header{
-
};
+
background-color:#444;
-
 
+
padding-top:20px;
-
floatingMenu.doFloatSingle = function(item)
+
padding-bottom:30px;
-
{
+
}
-
    this.findSingle(item);
+
#page-wrap #header h1{
-
 
+
margin-left:45px;
-
    var stepX, stepY;
+
font-size:2.8em;
-
 
+
margin-bottom:10px;
-
    this.computeParent(item);
+
line-height:0.9em;
-
 
+
}
-
    var cornerX = this.calculateCornerX(item);
+
#page-wrap #header h2{
-
 
+
margin-left:45px;
-
    var stepX = (cornerX - item.nextX) * item.distance;
+
font-size:1.7em;
-
    if (Math.abs(stepX) < .5 && item.snap
+
}
-
        || Math.abs(cornerX - item.nextX) == 1)
+
#page-wrap #content{
-
    {
+
background:url(images/content_bg.jpg) no-repeat;
-
        stepX = cornerX - item.nextX;
+
padding-top:85px;
-
    }
+
}
-
 
+
#page-wrap #content h1{
-
    var cornerY = this.calculateCornerY(item);
+
margin-left:45px;
-
 
+
font-size:2em;
-
    var stepY = (cornerY - item.nextY) * item.distance;
+
margin-bottom:10px;
-
    if (Math.abs(stepY) < .5 && item.snap
+
}
-
        || Math.abs(cornerY - item.nextY) == 1)
+
#page-wrap #content p{
-
    {
+
margin-left:45px;
-
        stepY = cornerY - item.nextY;
+
width:620px;
-
    }
+
text-align:justify;
-
 
+
margin-bottom:25px;
-
    if (Math.abs(stepX) > 0 ||
+
line-height:1.5em;
-
        Math.abs(stepY) > 0)
+
}
-
    {
+
#page-wrap #content p.first{
-
        item.nextX += stepX;
+
font-size:1.2em;
-
        item.nextY += stepY;
+
font-weight:bold;
-
        this.move(item);
+
}
-
    }
+
#page-wrap #content p.longer{
-
};
+
width:810px;
-
 
+
}
-
floatingMenu.fixTargets = function()
+
#page-wrap #footer{
-
{
+
background-color:#444;
-
};
+
}
-
 
+
#page-wrap #footer p{
-
floatingMenu.fixTarget = function(item)
+
width:auto;
-
{
+
margin:auto;
-
};
+
text-align:center;
-
 
+
font-size:0.9em;
-
floatingMenu.doFloat = function()
+
border:1px solid #000;
-
{
+
padding:15px 0;
-
    this.fixTargets();
+
}
-
    for (var i=0; i < floatingArray.length; i++)
+
#page-wrap #footer a:link{
-
    {
+
color:#09f;
-
        this.fixTarget(floatingArray[i]);
+
}
-
        this.doFloatSingle(floatingArray[i]);
+
#page-wrap #footer a:visited{
-
    }
+
text-decoration:none;
-
    setTimeout('floatingMenu.doFloat()', 20);
+
}
-
};
+
#page-wrap #footer a:hover{
-
 
+
color:#0f9;
-
floatingMenu.insertEvent = function(element, event, handler)
+
}
-
{
+
#page-wrap #footer a:active{
-
    // W3C
+
color:#f90;
-
    if (element.addEventListener != undefined)
+
}
-
    {
+
</style>
-
        element.addEventListener(event, handler, false);
+
-
        return;
+
-
    }
+
-
 
+
-
    var listener = 'on' + event;
+
-
 
+
-
    // MS
+
-
    if (element.attachEvent != undefined)
+
-
    {
+
-
        element.attachEvent(listener, handler);
+
-
        return;
+
-
    }
+
-
 
+
-
    // Fallback
+
-
    var oldHandler = element[listener];
+
-
    element[listener] = function (e)
+
-
        {
+
-
            e = (e) ? e : window.event;
+
-
            var result = handler(e);
+
-
            return (oldHandler != undefined)
+
-
                && (oldHandler(e) == true)
+
-
                && (result == true);
+
-
        };
+
-
};
+
-
 
+
-
floatingMenu.init = function()
+
-
{
+
-
    floatingMenu.fixTargets();
+
-
 
+
-
    for (var i=0; i < floatingArray.length; i++)
+
-
    {
+
-
        floatingMenu.initSingleMenu(floatingArray[i]);
+
-
    }
+
-
 
+
-
    setTimeout('floatingMenu.doFloat()', 100);
+
-
};
+
-
 
+
-
// Some browsers init scrollbars only after
+
-
// full document load.
+
-
floatingMenu.initSingleMenu = function(item)
+
-
{
+
-
    this.findSingle(item);
+
-
    this.computeParent(item);
+
-
    this.fixTarget(item);
+
-
    item.nextX = this.calculateCornerX(item);
+
-
    item.nextY = this.calculateCornerY(item);
+
-
    this.move(item);
+
-
};
+
-
 
+
-
floatingMenu.insertEvent(window, 'load', floatingMenu.init);
+
-
 
+
-
 
+
-
// Register ourselves as jQuery plugin if jQuery is present
+
-
if (typeof(jQuery) !== 'undefined')
+
-
{
+
-
    (function ($)
+
-
    {
+
-
        $.fn.addFloating = function(options)
+
-
        {
+
-
            return this.each(function()
+
-
            {
+
-
                floatingMenu.add(this, options);
+
-
            });
+
-
        };
+
-
    }) (jQuery);
+
-
}
+
-
 
+
-
</script>
+
</head>
</head>
-
 
<body>
<body>
-
 
+
     <div id="floatMenu">  
-
     <div id="floatdiv" style="   
+
         <ul class="menu1">  
-
         position:absolute;  
+
            <li><a href="#" onclick="return false;"> Home </a></li>  
-
        width:200px;height:50px;top:10px;right:10px; 
+
        </ul>   
-
        padding:16px;background:#FFFFFF;
+
-
        border:2px solid #2266AA; 
+
-
        z-index:100">
+
-
    This is a floating javascript menu.  
+
-
    </div>   
+
        
        
-
    <script type="text/javascript">
+
      <ul class="menu2">   
-
        floatingMenu.add('floatdiv',  
+
             <li><a href="#" onclick="return false;"> Table of content </a></li>  
-
            
+
            <li><a href="#" onclick="return false;"> Exam </a></li>  
-
                // Represents distance from left or right browser window  
+
            <li><a href="#" onclick="return false;"> Wiki </a></li>  
-
                // border depending upon property used. Only one should be  
+
        </ul>  
-
                // specified.  
+
-
                // targetLeft: 0, 
+
-
                targetRight: 10,  
+
        
        
-
                // Represents distance from top or bottom browser window  
+
        <ul class="menu3">  
-
                // border depending upon property used. Only one should be  
+
            <li><a href="#" onclick="return false;"> Technical support </a></li>  
-
                // specified. 
+
        </ul>  
-
                targetTop: 10, 
+
     </div>   
-
                // targetBottom: 0, 
+
-
     
+
-
                // Uncomment one of those if you need centering on 
+
-
                // X- or Y- axis. 
+
-
                // centerX: true, 
+
-
                // centerY: true, 
+
-
     
+
-
                // Remove this one if you don't want snap effect 
+
-
                snap: true 
+
-
            });  
+
-
     </script>   
+
-
 
+
-
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
-
 
+
-
--
+
-
 
+
-
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
+
-
 
+
-
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
+
-
 
+
-
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
+
-
 
+
-
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.
+
-
 
+
-
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.
+
-
 
+
-
Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
+
</body>
</body>
-
 
</html>
</html>

Latest revision as of 19:56, 13 September 2011