base.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. $(function(){
  2. //头部导航
  3. var navTitle = new Vue({
  4. el:"#header_nav_list",
  5. data:{
  6. items:[]
  7. }
  8. })
  9. $.ajax({
  10. url:"./json/1.json",
  11. type:"get",
  12. dataType:"json",
  13. success:function(msg){
  14. navTitle.items = msg;
  15. }
  16. })
  17. //头部二级导航
  18. var navTitle2 = new Vue({
  19. el:"#header_sed_nav_con",
  20. data:{
  21. items:[]
  22. }
  23. })
  24. $.ajax({
  25. url:"./json/2.json",
  26. type:"get",
  27. dataType:"json",
  28. success:function(msg){
  29. navTitle2.items = msg;
  30. }
  31. })
  32. //footer
  33. var footerMsg = new Vue({
  34. el:"#footer",
  35. data:{
  36. footerTitle:[],
  37. footerContent:[]
  38. }
  39. })
  40. $.ajax({
  41. url:"./json/footer.json",
  42. type:"get",
  43. dataType:"json",
  44. success:function(msg){
  45. footerMsg.footerTitle = msg.title;
  46. footerMsg.footerContent = msg.content;
  47. }
  48. })
  49. window.addEventListener("load",function(){
  50. //导航
  51. $("#header_nav_list>li").mouseover(function(event){
  52. var num = $(this).index();
  53. $("#header_sed_nav_con ul").eq(num).css("display","block").siblings("ul").css("display","none");
  54. $("#header_sed_nav_con ul").eq(num).mouseover(function(event){
  55. $("#header_sed_nav_con ul").eq(num).css("display","block").siblings("ul").css("display","none");
  56. event.stopPropagation();
  57. })
  58. event.stopPropagation();
  59. })
  60. $('#header_nav_list>li').mouseout(function(event){
  61. $('#header_sed_nav_con ul').css('display','none');
  62. $('#header_sed_nav_con ul').mouseout(function(event){
  63. $(this).css('display','none');
  64. event.stopPropagation();
  65. });
  66. event.stopPropagation();
  67. });
  68. })
  69. })