Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <link rel="stylesheet" href="" />
    <script type="text/javascript" src=""></script>
    <link rel="stylesheet" href="" />
    <div id="allmap" style="overflow:hidden;zoom:1;position:relative;">
        <div id="map" style="height:100%;-webkit-transition: all 0.5s ease-in-out;transition: all 0.5s ease-in-out;"></div>
    <div id="result">
        <input type="button" value="获取绘制的覆盖物个数" onclick="alert(overlays.length)" />
        <input type="button" value="清除所有覆盖物" onclick="clearAll()" />
    <div id="dd" style="position:absolute;left:5px;top:10px;height:20px;width:800px;">
        <input id="locat" style="width:800px" value="" type="text" />


                body, html {
            width: 100%;
            height: 100%;
            margin: 0;
            font-family: "微软雅黑";

        #allmap {
            width: 100%;
            height: 500px;
            overflow: hidden;

        #result {
            width: 100%;
            font-size: 12px;

        dl, dt, dd, ul, li {
            margin: 0;
            padding: 0;
            list-style: none;

        p {
            font-size: 12px;

        dt {
            font-size: 14px;
            font-family: "微软雅黑";
            font-weight: bold;
            border-bottom: 1px dotted #000;
            padding: 5px 0 5px 5px;
            margin: 5px 0;

        dd {
            padding: 5px 0 0 5px;

        li {
            line-height: 28px;


                // 百度地图API功能
        var map = new BMap.Map('map');
        map.centerAndZoom("银川", 10);
        map.addEventListener("click", function (e) {
            //alert(e.point.lng + "," +;
            document.getElementById("locat").value += "{'x':" + e.point.lng + ",'y':" + + "},";
        var overlays = [];
        var overlaycomplete = function (e) {
        var toolsclick = function (e) {
            document.getElementById("locat").value = "";
        var styleOptions = {
            strokeColor: "red",    //边线颜色。
            fillColor: "red",      //填充颜色。当参数为空时,圆形将没有填充效果。
            strokeWeight: 3,       //边线的宽度,以像素为单位。
            strokeOpacity: 0.8,	   //边线透明度,取值范围0 - 1。
            fillOpacity: 0.6,      //填充的透明度,取值范围0 - 1。
            strokeStyle: 'solid' //边线的样式,solid或dashed。
        var drawingManager = new BMapLib.DrawingManager(map, {
            isOpen: false, //是否开启绘制模式
            enableDrawingTool: true, //是否显示工具栏
            drawingToolOptions: {
                anchor: BMAP_ANCHOR_TOP_RIGHT, //位置
                offset: new BMap.Size(5, 5), //偏离值
            circleOptions: styleOptions, //圆的样式
            polylineOptions: styleOptions, //线的样式
            polygonOptions: styleOptions, //多边形的样式
            rectangleOptions: styleOptions //矩形的样式
        drawingManager.addEventListener('overlaycomplete', overlaycomplete);
        drawingManager.addEventListener('click', toolsclick);
        function clearAll() {
            for (var i = 0; i < overlays.length; i++) {
            overlays.length = 0