Difference between revisions of "Template:Pitt"
(47 intermediate revisions by the same user not shown) | |||
Line 12: | Line 12: | ||
(function($) { | (function($) { | ||
− | + | var defaults = { | |
− | + | topSpacing: 0, | |
− | + | bottomSpacing: 0, | |
− | + | className: 'is-sticky', | |
− | + | wrapperClassName: 'sticky-wrapper', | |
− | + | center: false, | |
− | + | getWidthFrom: '' | |
− | + | }, | |
− | + | $window = $(window), | |
− | + | $document = $(document), | |
− | + | sticked = [], | |
− | + | windowHeight = $window.height(), | |
− | + | scroller = function() { | |
− | + | var scrollTop = $window.scrollTop(), | |
− | + | documentHeight = $document.height(), | |
− | + | dwh = documentHeight - windowHeight, | |
− | + | extra = (scrollTop > dwh) ? dwh - scrollTop : 0; | |
− | + | for (var i = 0; i < sticked.length; i++) { | |
− | + | var s = sticked[i], | |
− | + | elementTop = s.stickyWrapper.offset().top, | |
− | + | etse = elementTop - s.topSpacing - extra; | |
− | + | if (scrollTop <= etse) { | |
− | + | if (s.currentTop !== null) { | |
− | + | s.stickyElement.css('position', '').css('top', ''); | |
− | + | s.stickyElement.parent().removeClass(s.className); | |
− | + | $("#menuContainer td").stop(true, false).animate({backgroundColor: '#000000'}, 250); | |
− | + | $("#menuContainer table").stop(true, false).animate({backgroundColor: '#000000'}, 250); | |
− | + | $("#menuContainer li").css({backgroundColor: '#000000'}); | |
− | + | s.currentTop = null; | |
− | + | } | |
− | + | } else { | |
− | + | var newTop = documentHeight - s.stickyElement.outerHeight() - s.topSpacing - s.bottomSpacing - scrollTop - extra; | |
− | + | if (newTop < 0) { | |
− | + | newTop = newTop + s.topSpacing; | |
− | + | } else { | |
− | + | newTop = s.topSpacing; | |
− | + | } | |
− | + | if (s.currentTop != newTop) { | |
− | + | s.stickyElement.css('position', 'fixed').css('top', newTop); | |
− | + | if (typeof s.getWidthFrom !== 'undefined') { | |
− | + | s.stickyElement.css('width', $(s.getWidthFrom).width()); | |
− | + | } | |
− | + | $("#menuContainer td").stop(true, false).animate({backgroundColor: '#383838'}, 250); | |
− | + | $("#menuContainer table").stop(true, false).animate({backgroundColor: '#383838'}, 250); | |
− | + | $("#menuContainer li").css({backgroundColor: '#383838'}); | |
− | + | s.stickyElement.parent().addClass(s.className); | |
− | + | s.currentTop = newTop; | |
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | resizer = function() { | ||
+ | windowHeight = $window.height(); | ||
+ | $("#menuContainer td:has(ul)").children("ul").each(function(){ | ||
+ | var padding = parseInt($(this).parent().css("padding-left")) + parseInt($(this).parent().css("padding-right")); | ||
+ | var newWidth = parseInt($(this).parent().css("width")) + padding; | ||
+ | $(this).css("width", newWidth + 'px'); | ||
+ | }); | ||
+ | }, | ||
+ | methods = { | ||
+ | init: function(options) { | ||
+ | var o = $.extend(defaults, options); | ||
+ | return this.each(function() { | ||
+ | var stickyElement = $(this); | ||
− | + | stickyId = stickyElement.attr('id'); | |
− | + | wrapper = $('<div></div>').attr('id', stickyId + '-sticky-wrapper').addClass(o.wrapperClassName); | |
− | + | stickyElement.wrapAll(wrapper); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | if (o.center) { | |
− | + | stickyElement.parent().css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"}); | |
− | + | } | |
− | + | ||
− | + | ||
− | + | if (stickyElement.css("float") == "right") { | |
− | + | stickyElement.css({"float":"none"}).parent().css({"float":"right"}); | |
− | + | } | |
− | + | var stickyWrapper = stickyElement.parent(); | |
− | + | stickyWrapper.css('height', stickyElement.outerHeight()); | |
− | + | sticked.push({ | |
+ | topSpacing: o.topSpacing, | ||
+ | bottomSpacing: o.bottomSpacing, | ||
+ | stickyElement: stickyElement, | ||
+ | currentTop: null, | ||
+ | stickyWrapper: stickyWrapper, | ||
+ | className: o.className, | ||
+ | getWidthFrom: o.getWidthFrom | ||
+ | }); | ||
+ | }); | ||
+ | }, | ||
+ | update: scroller | ||
+ | }; | ||
− | + | if (window.addEventListener) { | |
− | + | window.addEventListener('scroll', scroller, false); | |
− | + | window.addEventListener('resize', resizer, false); | |
− | + | } else if (window.attachEvent) { | |
− | + | window.attachEvent('onscroll', scroller); | |
− | + | window.attachEvent('onresize', resizer); | |
− | + | } | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | $.fn.sticky = function(method) { | |
− | + | return methods.init.apply( this, arguments ); | |
− | + | }; | |
− | + | $(function() { | |
− | + | setTimeout(scroller, 0); | |
− | + | }); | |
})(jQuery); | })(jQuery); | ||
Line 158: | Line 144: | ||
var padding = parseInt($(this).parent().css("padding-left")) + parseInt($(this).parent().css("padding-right")); | var padding = parseInt($(this).parent().css("padding-left")) + parseInt($(this).parent().css("padding-right")); | ||
var newWidth = parseInt($(this).parent().css("width")) + padding; | var newWidth = parseInt($(this).parent().css("width")) + padding; | ||
− | + | $(this).css("width", newWidth + 'px'); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}); | }); | ||
$("#menuContainer").sticky({topSpacing:16}); | $("#menuContainer").sticky({topSpacing:16}); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
}); | }); | ||
</script> | </script> | ||
Line 263: | Line 154: | ||
* { | * { | ||
− | margin: 0; | + | margin: 0; |
− | padding: 0; | + | padding: 0; |
} | } | ||
Line 271: | Line 162: | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
#content { | #content { | ||
Line 325: | Line 167: | ||
margin-right: 0px; | margin-right: 0px; | ||
width: 100%; | width: 100%; | ||
+ | top: -26px; | ||
} | } | ||
Line 336: | Line 179: | ||
#contentContainer { | #contentContainer { | ||
− | + | background-color: #FFECA0; | |
− | background-color: # | + | |
font-family: "Trebuchet MS", Helvetica, sans-serif; | font-family: "Trebuchet MS", Helvetica, sans-serif; | ||
− | + | padding-left: 15%; | |
+ | padding-right: 15%; | ||
} | } | ||
Line 375: | Line 218: | ||
#contentContainer a { | #contentContainer a { | ||
font-weight: bold; | font-weight: bold; | ||
− | color: # | + | color: #00043D; |
+ | text-decoration:underline; | ||
} | } | ||
Line 387: | Line 231: | ||
font-weight: bold; | font-weight: bold; | ||
line-height: 40px; | line-height: 40px; | ||
+ | cursor: pointer; | ||
} | } | ||
Line 401: | Line 246: | ||
position: relative; | position: relative; | ||
text-align: center; | text-align: center; | ||
− | background-color: #000000; | + | background-color: #000000; |
color: #ffffff; | color: #ffffff; | ||
margin: 0px; | margin: 0px; | ||
white-space: nowrap; | white-space: nowrap; | ||
+ | width:12.5%; | ||
} | } | ||
#menuContainer table { | #menuContainer table { | ||
− | background-color: #000000; | + | background-color: #000000; |
− | width: 100%; | + | width: 100%; |
} | } | ||
Line 419: | Line 265: | ||
display: none; | display: none; | ||
opacity: 0.8; | opacity: 0.8; | ||
+ | } | ||
+ | |||
+ | #bannerCanvas { | ||
+ | position: fixed; | ||
+ | width: 100%; | ||
+ | z-index:-1; | ||
+ | height: 100%; | ||
+ | left: 0; | ||
+ | top: 0; | ||
+ | } | ||
+ | |||
+ | #menuContainer { | ||
+ | z-index: 10; | ||
} | } | ||
Line 456: | Line 315: | ||
<td> | <td> | ||
− | <a href=" | + | <a href="https://2015.igem.org/Team:Pitt/Description">Project</a> |
<ul> | <ul> | ||
<li> | <li> | ||
− | <a href="https://2015.igem.org/Team:Pitt/Project"> | + | <a href="https://2015.igem.org/Team:Pitt/Description">Overview</a> |
+ | </li> | ||
+ | <li> | ||
+ | <a href="https://2015.igem.org/Team:Pitt/Estrogen/Project">Estrogen Sensor</a> | ||
</li> | </li> | ||
<li> | <li> | ||
− | <a> | + | <a href="https://2015.igem.org/Team:Pitt/Protease/Project">Protease Sensor</a> |
</li> | </li> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<li> | <li> | ||
− | <a href="https://2015.igem.org/Team:Pitt/Project"> | + | <a href="https://2015.igem.org/Team:Pitt/3-hybrid/Project">Three-Hybrid Versatile Sensor</a> |
</li> | </li> | ||
<li> | <li> | ||
− | <a> | + | <a href="https://2015.igem.org/Team:Pitt/Amplification/Project">Amplification and Quenching</a> |
</li> | </li> | ||
+ | |||
</ul> | </ul> | ||
</td> | </td> | ||
<td> | <td> | ||
− | <a href=" | + | <a href="https://2015.igem.org/Team:Pitt/Notebook">Notebook</a> |
<ul> | <ul> | ||
<li> | <li> | ||
− | <a href="https://2015.igem.org/Team:Pitt/ | + | <a href="https://2015.igem.org/Team:Pitt/Protocols">Sensor Extract Protocol</a> |
</li> | </li> | ||
<li> | <li> | ||
− | <a> | + | <a href="https://2015.igem.org/Team:Pitt/Notebook">Daily Notebook</a> |
</li> | </li> | ||
</ul> | </ul> | ||
Line 495: | Line 351: | ||
<td> | <td> | ||
− | <a href=" | + | <a href="https://2015.igem.org/Team:Pitt/Parts">Parts</a> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</td> | </td> | ||
+ | <td> | ||
+ | <a href="https://2015.igem.org/Team:Pitt/Practices">Human Practices</a> | ||
+ | </td> | ||
<td> | <td> | ||
− | <a href=" | + | <a href="https://2015.igem.org/Team:Pitt/Team">Team</a> |
− | + | <ul> | |
− | + | ||
<li> | <li> | ||
− | <a href="https://2015.igem.org/Team:Pitt/ | + | <a href="https://2015.igem.org/Team:Pitt/Team">Meet us!</a> |
</li> | </li> | ||
<li> | <li> | ||
− | <a> | + | <a href="https://2015.igem.org/Team:Pitt/Attributions">Attributions</a> |
</li> | </li> | ||
+ | |||
</ul> | </ul> | ||
</td> | </td> | ||
<td> | <td> | ||
− | + | <a href="https://2015.igem.org/Team:Pitt/Sponsors">Sponsors</a> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</td> | </td> | ||
<td> | <td> | ||
− | + | <a href="https://igem.org/Main_Page">2015 iGEM Home</a> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</td> | </td> | ||
</tr></table> | </tr></table> | ||
</div> | </div> | ||
− | |||
<div id="contentContainer"><!--The closing tag for contentContainer should be placed at the bottom of each content page.--> | <div id="contentContainer"><!--The closing tag for contentContainer should be placed at the bottom of each content page.--> | ||
</html> | </html> |
Latest revision as of 03:15, 19 September 2015