Difference between revisions of "Team:Glasgow/Education"
(Created page with "{{GlasgowNavbar}} <html> <head> <style> .firstHeading { display:none; } #content { width:auto; height:auto;...") |
Adele.cook (Talk | contribs) |
||
Line 2: | Line 2: | ||
<html> | <html> | ||
<head> | <head> | ||
+ | <script type="text/javascript" > | ||
+ | function menuFixed(id){ | ||
+ | var obj = document.getElementById(id); | ||
+ | var _getHeight = obj.offsetTop; | ||
+ | |||
+ | window.onscroll = function(){ | ||
+ | changePos(id,_getHeight); | ||
+ | } | ||
+ | } | ||
+ | function changePos(id,height){ | ||
+ | var obj = document.getElementById(id);var windowBottom = $(window).scrollTop() + $(window).innerHeight(); | ||
+ | var scrollTop = document.documentElement.scrollTop || document.body.scrollTop - 150; | ||
+ | var windowBottom = $(window).scrollTop() + $(window).innerHeight(); | ||
+ | var w = window.innerWidth; | ||
+ | if(w>=1024){ | ||
+ | if($(window).scrollTop() + $(window).height() > $(document).height() - 500){ | ||
+ | $('#sidebar').fadeOut("fast");}else{$('#sidebar').fadeIn("fast");} | ||
+ | } | ||
+ | if(scrollTop < height){ obj.style.position = 'relative'; | ||
+ | }else{ | ||
+ | obj.style.position = 'fixed'; | ||
+ | } | ||
+ | } | ||
+ | </script> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | window.onload = function(){ | ||
+ | menuFixed('sidebar'); | ||
+ | } | ||
+ | </script> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | // 收缩展开效果 | ||
+ | $(document).ready(function(){ | ||
+ | // $(".box h5").toggle(function(){ | ||
+ | // $(this).next(".text").animate({height: 'toggle', opacity: 'toggle'}, "slow"); | ||
+ | // },function(){ | ||
+ | //$(this).next(".text").animate({height: 'toggle', opacity: 'toggle'}, "slow"); | ||
+ | //}); | ||
+ | $("div.text").hide();//默认隐藏div,或者在样式表中添加.text{display:none},推荐使用后者 | ||
+ | $(".box h5").click(function(){ | ||
+ | $(this).next(".text").slideToggle("slow"); | ||
+ | }) | ||
+ | }); | ||
+ | </script> | ||
<style> | <style> | ||
.firstHeading { | .firstHeading { |
Revision as of 19:02, 16 September 2015