开发者

google geo autocomplete showing options above input

开发者 https://www.devze.com 2023-02-27 03:18 出处:网络
how to show google geo autocomplete suggested locations above the input box. By default it shows under the input box.

how to show google geo autocomplete suggested locations above the input box. By default it shows under the input box.

Updated code

$('#testinput').geo_autocomplete(new google.maps.Geocoder, {
        mapkey: 'ABQIAAAA9zwaGXY8VJfahtEvIhFqRxQxHJFQqLPid4j-bqIolB-PApACxRRl-6RW4s2FYG7jrEBuytEwCKb02Q',
        selectFirst: true,
        minChars: 3,
        cacheLength: 50,
        width: 200,
        scroll: true,
        scrollHeight: 330,
        position: { my: 'left bottom', at: 'left top' }
    }).result(function (_event, _data) {
        if (_data) {
            try {
                map.fitBounds(_data.geometry.viewport)
            } catch (error) { }
        开发者_StackOverflow中文版};
    });


Thanks for the clarification.

In order to do this using geo-autocomplete, you would need to customise it so that you can allow a 'position' option to be passed to the jQuery UI Autocomplete widget that it makes use of.

I've made a quick demo here: http://jsbin.com/eyobi6

All this does is add the following line to 'ui.geo_autocomplete.js':

position: { my: 'left bottom', at: 'left top' },

You can place it anywhere within the options object, but I placed it after the following line:

delay: 300, // see http://jqueryui.com/demos/autocomplete/#option-delay
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号