swap origin and destination

This commit is contained in:
Laura Klünder 2017-10-29 17:03:02 +01:00
parent f29183b68a
commit 28945f1a36
2 changed files with 13 additions and 2 deletions

View file

@ -15,10 +15,21 @@ c3nav = {
c3nav.init_locationinputs();
$('#location-buttons').find('.route').on('click', c3nav._location_buttons_route_click);
$('#route-buttons').find('.swap').on('click', c3nav._route_buttons_swap_click);
},
_location_buttons_route_click: function () {
$('#search').removeClass('location-view').addClass('route-view');
},
_route_buttons_swap_click: function () {
var $search = $('#search'),
$origin = $('#origin-input'),
$destination = $('#destination-input');
tmp = $origin.data('location');
c3nav._locationinput_set($origin, $destination.data('location'));
c3nav._locationinput_set($destination, tmp);
$origin.stop().css('top', '55px').animate({top: 0}, 150);
$destination.stop().css('top', '-55px').animate({top: 0}, 150);
},
init_locationinputs: function () {
c3nav.locations = [];

View file

@ -43,8 +43,8 @@
<button class="button-clear route">Route</button>
</div>
<div class="buttons" id="route-buttons">
<button class="button-clear">swap</button>
<button class="button-clear">Options</button>
<button class="button-clear swap">swap</button>
<button class="button-clear options">Options</button>
</div>
</section>
<div id="resultswrapper">