2247134155 / jquery-ui-map

Automatically exported from code.google.com/p/jquery-ui-map
0 stars 0 forks source link

AddControl Problem #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using the following code to try and display a custom control on the maps:

var myCustomControlDiv = document.createElement('div');
            var myCustomControl = new MyCustomControl(myCustomControlDiv);

            $('#map_canvas').gmap('addControl', 'myCustomControl', google.maps.ControlPosition.LEFT_TOP);

function MyCustomControl(controlDiv) {

            var control = this;

            var testBtn = document.createElement('div');
            testBtn.id = 'testBtn';
            testBtn.innerHTML = 'Alert!';
            controlDiv.appendChild(testBtn);

            // wire up jquery click
            $(testBtn).click(function () {
                alert('jquery click event');
            });

            // wire up jquery hover
            $(testBtn).hover(function () {
                $(this).toggleClass('btnHover');
            });
        }

The control will not appear for some reason.  I couldn't find any good examples 
of this and was hoping you could help me out.

Original issue reported on code.google.com by raged...@students.ipfw.edu on 16 Feb 2012 at 8:34

GoogleCodeExporter commented 9 years ago
Ask in the forum.

$('#map_canvas').gmap('addControl', myCustomControl, 
google.maps.ControlPosition.LEFT_TOP);

Original comment by johansalllarsson on 27 Mar 2012 at 8:42