123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- var map;
- LoadApi(function () {
- map = new BMap.Map("water_map", { mapType: getDefaultMapType() });
- LoadOverlayImage(map); //加载瓦片图
- ShowControl(map); //显示缩放控件
- ShowZoom(map); //启动鼠标拖动
- // ShowScale(map, 0); //添加比例尺
- InitCenterAndZoom(map, 116.004303, 29.736834, 12);
- });
- // -----------------------------------------------------------------------------------------
- var YTMenu = (function() {
- function load_title_said_bar(){
- var aleft = $(".nav_bar_tool li.active").offset().left - $(".title_bar_sub_left").width();
- var awidth = $(".nav_bar_tool li.active").width();
- $('.floatr_active').css({ "left": aleft + "px", "width": awidth + "px" });
- $(".nav_bar_tool li").mouseover(function(){
- var left = $(this).offset().left - ($(this).parents(".nav_tool_bar_box").offset().left);
- var width = $(this).width();
- $(".floatr_active").animate({width:width+"px",left:left+"px"},10);
- });
- /*$(".nav_bar_tool li").mouseout(function(){
- var left = $(this).siblings("li.active").offset().left - ($(this).parents(".nav_tool_bar_box").offset().left);
- var width = $(this).siblings("li.active").width();
- $(".floatr_active").animate({width:width+"px",left:left+"px"},10);
- });*/
- /*$(".nav_bar_tool li").hover(function(){
- var left = $(this).offset().left - ($(this).parents(".nav_tool_bar_box").offset().left);
- var width = $(this).width();
- $(".floatr_active").animate({width:width+"px",left:left+"px"},10);
- },function(){
- var left = $(this).siblings("li.active").offset().left - ($(this).parents(".nav_tool_bar_box").offset().left);
- var width = $(this).siblings("li.active").width();
- $(".floatr_active").animate({width:width+"px",left:left+"px"},10);
- });*/
- /* $(".nav_bar_tool li").click(function(){
- $(this).siblings('li').removeClass('active');
- $(this).addClass('active');
- return false;
- });*/
- };
- function init() {
- /* 图表区按钮事件 */
- $(".charts_show_btn").click(function(){
- var charts_code = $(this).attr("chartscode");
- var road = $(this).attr("road");
- var $char_win = document.createElement("iframe");
- $($char_win).attr("src",road).attr("frameborder",0).attr("scrolling","no")
- .css({"width":"100%","height":"350px"}).attr("display","none");
- $("#char_close").fadeIn(1000);
- $("#map_chart").fadeIn(1).animate({width:'400px',height:'400px'},1000);
- $("#map_chart_coun").append($char_win).fadeIn(1000);
- $($char_win).fadeIn(1000);
-
- });
- /* 图表面板关闭按钮事件*/
- $("#char_close").click(function(){
- $("#char_close").fadeOut(1000);
- $("#map_chart_coun").fadeOut(1000);
- $("#map_chart").animate({width:'0',height:'0'},1000).fadeOut(300);
- });
- /* 图层查询面板按钮事件 */
- $("#search_plan_btn").toggle(function(){
- $(this).animate({ left:'240px' },1000);
- $("#search_plan").animate({width:'220px'},1000);
- $("#search_plan_coun").fadeIn(1).animate({width:'220px'},1000);
- $(".search_plan_coun_box").fadeIn(1000);
- $(this).removeClass("plan_btn_left").addClass("plan_btn_right");
- $(".three_flag").removeClass("float_left").addClass("float_right");
- $(".direction_marker").removeClass("float_right triangle_left").addClass("float_left triangle_right");
- $(".one_flag").each(function(i){
- $(this).removeClass("of_left").addClass("of_right");
- });
- },function(){
- $(this).animate({left:'20px'},1000);
- $("#search_plan").animate({width:'0'},1000);
- $("#search_plan_coun").animate({width:'0'},1000).fadeOut(300);
- $(".search_plan_coun_box").fadeOut(1000);
- $(this).removeClass("plan_btn_right").addClass("plan_btn_left");
- $(".three_flag").removeClass("float_right").addClass("float_left");
- $(".direction_marker").removeClass("float_left triangle_right").addClass("float_right triangle_left");
- $(".one_flag").each(function(i){
- $(this).removeClass("of_right").addClass("of_left");
- });
- });
- /* 图层标题鼠标滑过效果 */
- $(".nav_bar").mouseover(function(){
- $(this).find(".bracket_sp").fadeIn(1).animate({padding:"0 15px"},200);
- });
- $(".nav_bar").mouseout(function(){
- $(this).find(".bracket_sp").animate({padding:"0"},200).fadeOut(200);
- });
- $("body").click(function(e){
- $(".lf_plan").attr("isclosed","yes");
- return plan_resize(null);
- });
- /* 图层标题点击事件 */
- $(".nav_bar").click(function(e){
- var $plan = $(".lf_plan");
- var isclose = $($plan).attr("isclosed");
- if(isclose=="yes"){
- $($plan).attr("isclosed","no");
- var plan_num = $(this).attr("plannum");
- var $fat_close = document.createElement("span");
- $($fat_close).attr("id","fat_close").addClass("close fat lfp");
- $($fat_close).on("click",function(e1){
- $(".lf_plan").attr("isclosed","yes");
- return plan_resize(e1);
- });
- $(".lf_plan").empty().append($fat_close).append(getLayerSearchPlan()[plan_num]);
- return plan_increase($plan,e);
- }else{
- $($plan).attr("isclosed","yes");
- return plan_resize(e);
- };
- });
- /*$("#title_bar").unbind("mouseover").bind("mouseover",function(e){
- var $plan = $(".lf_plan");
- return plan_increase($plan,e);
- }).unbind("mouseout").bind("mouseout",function(e){
- return plan_resize(e);
- });*/
- };
- /* 图层查询面板显示 */
- function plan_increase($plan,e){
- var exps = $plan.data("exps");
- if(!exps){
- $plan.data("exps","yes");
- };
- var style = $plan.attr("style");
- $plan.addClass("current").attr("styleold",style);
- $plan.stop();
- $plan.fadeIn(1).animate({width:"300px",height:"300px",top:"15%",left:"250px"},600);
- e.stopPropagation();
- return false;
- };
- /* 图层查询面板隐藏 */
- function plan_resize(e){
- var $plan = $(".current.lf_plan");
- $plan.stop();
- $plan.animate({width:"0",height:"0",top:"15%",left:"250px"},600,null,function(){
- $plan.removeClass("current").removeAttr("style","");
- }).fadeOut(600);
- var exps = $plan.data("exps");
- if(exps){
- $plan.data("exps",null);
- }
- if(e){
- e.stopPropagation();
- return false;
- }else{
- return true;
- };
- };
- /* 得到图层查询面板中的查询条件 */
- function getLayerSearchPlan(){
- var $rcqx = document.createElement("div");
- $($rcqx).html("日常气象");
- var $tftc = document.createElement("div");
- $($tftc).html("台风图层");
- var $yjxy = document.createElement("div");
- $($yjxy).html("预警与响应");
- var $dwzs = document.createElement("div");
- $($dwzs).html("应急队伍展示");
- var $fdczs = document.createElement("div");
- $($fdczs).html("应急发电车展示");
- var $fdjzs = document.createElement("div");
- $($fdjzs).html("应急发电机展示");
- var $lscs = document.createElement("div");
- $($lscs).html("临时场所");
- var $yjck = document.createElement("div");
- $($yjck).html("应急仓库");
- var $htgj = document.createElement("div");
- $($htgj).html("绘图工具");
- var $dbdw = document.createElement("div");
- $($dbdw).html("调拨队伍动态");
- var fl_plan = {rcqx:$rcqx, tftc:$tftc, yjxy:$yjxy, dwzs:$dwzs, fdczs:$fdczs, fdjzs:$fdjzs,
- lscs:$lscs, yjck:$yjck, htgj:$htgj, dbdw:$dbdw};
- return fl_plan;
- };
- init();
- load_title_said_bar();
- })();
|