CSS样式表
#menu { width: 180px; position: relative; top: 50px; }
点击选择所属省份的链接
<!--交互菜单--> <div id="menu"> <span><a href="#" onclick="getCity('shanghai', '上海');">上海</a></span> <span><a href="#" onclick="getCity('hebei', '河北');">河北</a></span> <span><a href="#" onclick="getCity('neimenggu', '内蒙古');">内蒙古</a></span> <span><a href="#" onclick="getCity('zhejiang', '浙江');">浙江</a></span> </div>
执行封装函数
//构建交互操作菜单;by poleng 2020.09.10 function getCity(provinces, provincesText) { //显示返回按钮; $('#back').removeClass('hidden'); mapName = provincesText; //显示选择的省份; if (provinces) { showProvince(provinces, provincesText); } }
Done!