Sha256: 6e5301e2ad4989994ad0c20a32a1dee12f4f635c588f1aa0e928544cc0ee7c7b

Contents?: true

Size: 1.58 KB

Versions: 9

Compression:

Stored size: 1.58 KB

Contents

/**
 * Сфокусироваться на точке на карте.
 * Если надо - открыть balloon.
 * @param id : id офиса.
 */
function _item_toggle(id) {
    //console.log('<_item_toggle> id: ' + id);

    var it = dealers_map.geoObjects.getIterator(),
        group;

    while(group = it.getNext()) {
        //console.log(group.properties);
        if (group.properties !== undefined) {
            for (var i = 0, len = group.getLength(); i < len; i++) {
                var placemark = group.get(i);
                //console.log(placemark.properties.get('id'));
                if (placemark.properties.get('id') === id) {
                    //console.log('+ ' + placemark.balloon.isOpen());
                    if (placemark.balloon.isOpen()) {
                        placemark.balloon.close();
                    }
                    else {
                        dealers_map.panTo(placemark.geometry.getCoordinates(), {
                            delay: 0
                        }).then(function () {
                            placemark.balloon.open();
                        });
                    }
                    return;
                }
            }
            break;
        }
    }
}

/**
 * Начинаем слушать клики по .li_office.
 * При клике - вызовется _item_toggle.
 */
function _dealers_left_list_clicks() {
    $('.li_office').on("click", function (e) {
        e.preventDefault();
        var office_id = $(this).data('id');
        _item_toggle(office_id);
    });
}

$(document).ready(_dealers_left_list_clicks);

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
c80_push-0.1.0.11 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_dealers_left_list_clicks.js
c80_push-0.1.0.10 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_dealers_left_list_clicks.js
c80_push-0.1.0.8 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_dealers_left_list_clicks.js
c80_push-0.1.0.7 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_dealers_left_list_clicks.js
c80_push-0.1.0.6 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_dealers_left_list_clicks.js
c80_push-0.1.0.5 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_dealers_left_list_clicks.js
c80_push-0.1.0.4 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_dealers_left_list_clicks.js
c80_push-0.1.0.3 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_dealers_left_list_clicks.js
c80_push-0.1.0.2 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_dealers_left_list_clicks.js