We are used to see geocoders with address input field and [Search] button.
We can discard the button and use 'onchange' event of the input field instead.
It works quite well. Just type in the address and click anywhere on the page. Well not anywhere because click on map is preventDefaulted. Hitting [Enter] key works too. @M$: please don't file a patent application.
Text input field can also be used for showing how the geocoder actually understood the address.
Full example.
Tuesday, December 08, 2009
Monday, December 07, 2009
Sidebar with makeMarker() v3
Wouldn't that be convenient if makeMarker(options) would construct a sidebar entry as well. See it here.
A separate SidebarItem() constructor was written. It creates a button element and appends that to a div with id="sidebar" by default. makeMarker() calls the constructor if you have set an option property {sidebarItem: "My label"}
The basic button element needs some CSS cure. You can also style individual sidebar items by setting different CSS class names for them. {sidebarItemClassName: "important_item"}
The events are set to work bidirectionally.
Also you can use :hover and :focus CSS pseudoselectors. (:focus does not work with IE)
SidebarItem() instance has methods addIn() and remove(). We need addIn() to decide where to add the item. That helps to implement the categories.
A separate SidebarItem() constructor was written. It creates a button element and appends that to a div with id="sidebar" by default. makeMarker() calls the constructor if you have set an option property {sidebarItem: "My label"}
The basic button element needs some CSS cure. You can also style individual sidebar items by setting different CSS class names for them. {sidebarItemClassName: "important_item"}
The events are set to work bidirectionally.
- click on sidebar -> click on marker
- select on sidebar -> click on marker (select by [Tab])
- click on marker -> focus on sidebar
- mouseover on sidebar -> mouseover on marker
- mouseout on sidebar -> mouseout on marker
Also you can use :hover and :focus CSS pseudoselectors. (:focus does not work with IE)
SidebarItem() instance has methods addIn() and remove(). We need addIn() to decide where to add the item. That helps to implement the categories.
Subscribe to:
Posts (Atom)