7e6bba470c386fc88eba3f5f12f9c68106790656.svn-base 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. var map;
  2. LoadApi(function () {
  3. map = new BMap.Map("water_map", { mapType: getDefaultMapType() });
  4. LoadOverlayImage(map); //加载瓦片图
  5. ShowControl(map); //显示缩放控件
  6. ShowZoom(map); //启动鼠标拖动
  7. // ShowScale(map, 0); //添加比例尺
  8. InitCenterAndZoom(map, 116.004303, 29.736834, 12);
  9. });
  10. // -----------------------------------------------------------------------------------------
  11. var YTMenu = (function() {
  12. function load_title_said_bar(){
  13. var aleft = $(".nav_bar_tool li.active").offset().left - $(".title_bar_sub_left").width();
  14. var awidth = $(".nav_bar_tool li.active").width();
  15. $('.floatr_active').css({ "left": aleft + "px", "width": awidth + "px" });
  16. $(".nav_bar_tool li").mouseover(function(){
  17. var left = $(this).offset().left - ($(this).parents(".nav_tool_bar_box").offset().left);
  18. var width = $(this).width();
  19. $(".floatr_active").animate({width:width+"px",left:left+"px"},10);
  20. });
  21. /*$(".nav_bar_tool li").mouseout(function(){
  22. var left = $(this).siblings("li.active").offset().left - ($(this).parents(".nav_tool_bar_box").offset().left);
  23. var width = $(this).siblings("li.active").width();
  24. $(".floatr_active").animate({width:width+"px",left:left+"px"},10);
  25. });*/
  26. /*$(".nav_bar_tool li").hover(function(){
  27. var left = $(this).offset().left - ($(this).parents(".nav_tool_bar_box").offset().left);
  28. var width = $(this).width();
  29. $(".floatr_active").animate({width:width+"px",left:left+"px"},10);
  30. },function(){
  31. var left = $(this).siblings("li.active").offset().left - ($(this).parents(".nav_tool_bar_box").offset().left);
  32. var width = $(this).siblings("li.active").width();
  33. $(".floatr_active").animate({width:width+"px",left:left+"px"},10);
  34. });*/
  35. /* $(".nav_bar_tool li").click(function(){
  36. $(this).siblings('li').removeClass('active');
  37. $(this).addClass('active');
  38. return false;
  39. });*/
  40. };
  41. function init() {
  42. /* 图表区按钮事件 */
  43. $(".charts_show_btn").click(function(){
  44. var charts_code = $(this).attr("chartscode");
  45. var road = $(this).attr("road");
  46. var $char_win = document.createElement("iframe");
  47. $($char_win).attr("src",road).attr("frameborder",0).attr("scrolling","no")
  48. .css({"width":"100%","height":"350px"}).attr("display","none");
  49. $("#char_close").fadeIn(1000);
  50. $("#map_chart").fadeIn(1).animate({width:'400px',height:'400px'},1000);
  51. $("#map_chart_coun").append($char_win).fadeIn(1000);
  52. $($char_win).fadeIn(1000);
  53. });
  54. /* 图表面板关闭按钮事件*/
  55. $("#char_close").click(function(){
  56. $("#char_close").fadeOut(1000);
  57. $("#map_chart_coun").fadeOut(1000);
  58. $("#map_chart").animate({width:'0',height:'0'},1000).fadeOut(300);
  59. });
  60. /* 图层查询面板按钮事件 */
  61. $("#search_plan_btn").toggle(function(){
  62. $(this).animate({ left:'240px' },1000);
  63. $("#search_plan").animate({width:'220px'},1000);
  64. $("#search_plan_coun").fadeIn(1).animate({width:'220px'},1000);
  65. $(".search_plan_coun_box").fadeIn(1000);
  66. $(this).removeClass("plan_btn_left").addClass("plan_btn_right");
  67. $(".three_flag").removeClass("float_left").addClass("float_right");
  68. $(".direction_marker").removeClass("float_right triangle_left").addClass("float_left triangle_right");
  69. $(".one_flag").each(function(i){
  70. $(this).removeClass("of_left").addClass("of_right");
  71. });
  72. },function(){
  73. $(this).animate({left:'20px'},1000);
  74. $("#search_plan").animate({width:'0'},1000);
  75. $("#search_plan_coun").animate({width:'0'},1000).fadeOut(300);
  76. $(".search_plan_coun_box").fadeOut(1000);
  77. $(this).removeClass("plan_btn_right").addClass("plan_btn_left");
  78. $(".three_flag").removeClass("float_right").addClass("float_left");
  79. $(".direction_marker").removeClass("float_left triangle_right").addClass("float_right triangle_left");
  80. $(".one_flag").each(function(i){
  81. $(this).removeClass("of_right").addClass("of_left");
  82. });
  83. });
  84. /* 图层标题鼠标滑过效果 */
  85. $(".nav_bar").mouseover(function(){
  86. $(this).find(".bracket_sp").fadeIn(1).animate({padding:"0 15px"},200);
  87. });
  88. $(".nav_bar").mouseout(function(){
  89. $(this).find(".bracket_sp").animate({padding:"0"},200).fadeOut(200);
  90. });
  91. $("body").click(function(e){
  92. $(".lf_plan").attr("isclosed","yes");
  93. return plan_resize(null);
  94. });
  95. /* 图层标题点击事件 */
  96. $(".nav_bar").click(function(e){
  97. var $plan = $(".lf_plan");
  98. var isclose = $($plan).attr("isclosed");
  99. if(isclose=="yes"){
  100. $($plan).attr("isclosed","no");
  101. var plan_num = $(this).attr("plannum");
  102. var $fat_close = document.createElement("span");
  103. $($fat_close).attr("id","fat_close").addClass("close fat lfp");
  104. $($fat_close).on("click",function(e1){
  105. $(".lf_plan").attr("isclosed","yes");
  106. return plan_resize(e1);
  107. });
  108. $(".lf_plan").empty().append($fat_close).append(getLayerSearchPlan()[plan_num]);
  109. return plan_increase($plan,e);
  110. }else{
  111. $($plan).attr("isclosed","yes");
  112. return plan_resize(e);
  113. };
  114. });
  115. /*$("#title_bar").unbind("mouseover").bind("mouseover",function(e){
  116. var $plan = $(".lf_plan");
  117. return plan_increase($plan,e);
  118. }).unbind("mouseout").bind("mouseout",function(e){
  119. return plan_resize(e);
  120. });*/
  121. };
  122. /* 图层查询面板显示 */
  123. function plan_increase($plan,e){
  124. var exps = $plan.data("exps");
  125. if(!exps){
  126. $plan.data("exps","yes");
  127. };
  128. var style = $plan.attr("style");
  129. $plan.addClass("current").attr("styleold",style);
  130. $plan.stop();
  131. $plan.fadeIn(1).animate({width:"300px",height:"300px",top:"15%",left:"250px"},600);
  132. e.stopPropagation();
  133. return false;
  134. };
  135. /* 图层查询面板隐藏 */
  136. function plan_resize(e){
  137. var $plan = $(".current.lf_plan");
  138. $plan.stop();
  139. $plan.animate({width:"0",height:"0",top:"15%",left:"250px"},600,null,function(){
  140. $plan.removeClass("current").removeAttr("style","");
  141. }).fadeOut(600);
  142. var exps = $plan.data("exps");
  143. if(exps){
  144. $plan.data("exps",null);
  145. }
  146. if(e){
  147. e.stopPropagation();
  148. return false;
  149. }else{
  150. return true;
  151. };
  152. };
  153. /* 得到图层查询面板中的查询条件 */
  154. function getLayerSearchPlan(){
  155. var $rcqx = document.createElement("div");
  156. $($rcqx).html("日常气象");
  157. var $tftc = document.createElement("div");
  158. $($tftc).html("台风图层");
  159. var $yjxy = document.createElement("div");
  160. $($yjxy).html("预警与响应");
  161. var $dwzs = document.createElement("div");
  162. $($dwzs).html("应急队伍展示");
  163. var $fdczs = document.createElement("div");
  164. $($fdczs).html("应急发电车展示");
  165. var $fdjzs = document.createElement("div");
  166. $($fdjzs).html("应急发电机展示");
  167. var $lscs = document.createElement("div");
  168. $($lscs).html("临时场所");
  169. var $yjck = document.createElement("div");
  170. $($yjck).html("应急仓库");
  171. var $htgj = document.createElement("div");
  172. $($htgj).html("绘图工具");
  173. var $dbdw = document.createElement("div");
  174. $($dbdw).html("调拨队伍动态");
  175. var fl_plan = {rcqx:$rcqx, tftc:$tftc, yjxy:$yjxy, dwzs:$dwzs, fdczs:$fdczs, fdjzs:$fdjzs,
  176. lscs:$lscs, yjck:$yjck, htgj:$htgj, dbdw:$dbdw};
  177. return fl_plan;
  178. };
  179. init();
  180. load_title_said_bar();
  181. })();