How to create zoom in button in gmap3 - jquery-gmap3

I want to zoom in or out of Google Maps with the buttons I designed.
but I'm not do well jquery code
$('#zoomInButton').click(function(){
map.setZoom(map.getZoom() + 1); //Let me know what to do with this part.
});

Related

Openlayers3 mousewheelzoom and keyboardzoom doesnt seem to work

I want to disable mousewheelzoom and keyboardzoom on openlayers3 map.
I am using it this way with map initialization.
interactions: ol.interaction.defaults({MouseWheelZoom:false, KeyboardZoom:false}),
However it doesnt seem to work, I can still zoom using mousewheel and with keyboard + and - keys.
Am I doing anything wrong ?
Keys are case sensitive, so mouseWheelZoom and keyboard see http://openlayers.org/en/latest/apidoc/ol.interaction.html#.defaults

implementting right click event on google maps marker

Need to have right-click event on google map marker.
Is there any javascript plugin for web application to implement the same?
Try to use the long press event in place of right click
Like this
HTML:
Long press
JavaScript
$("a").mouseup(function(){
// Clear timeout
return false;
}).mousedown(function(){
// Set timeout
return false;
});
You just need to apply a rightclick event to the marker and when right clicked it will pass the MouseEvent to a specified callback. Like this:
marker.addListener("rightclick", callback(event));
Here is the MouseEvent documentation and here is the Marker object documentation.

Phonegap prevent scrolling when show keyboard

On Phonegap application, is there any way to prevent page scrolling when a text-input is focused and the soft keyboard shows?
In case of no way, Is there any way to scroll the page to the position of text input instead of 'bring' the text input onto center of screen?
in phonegap 2.6 there is a new option to prevent scrolling by resizing the webview. take a look at the documentation and find the KeyboardShrinksView option.
cheers
I've used this javascript code with some success. It overrides the window.scrollTo function and cancels it out...
window.oldScrollTo = window.scrollTo;
window.scrollTo = function (x, y) {
console.log("window.scrollTo");
return;
};

iPad parallax flickering

I am using a parallax effect with javascript but I'm having issues with iPad.
I know the "$(window).scroll" is not triggered on webkit touch devides - only when we release the screen - so i'm using:
window.addEventListener("touchmove", triggerScroll, false);
function triggerScroll(event)
{
var scrollTop = $(window).scrollTop();//event.touches[0].pageY; //window.pageYOffset();
$("#allCanvas .divCanvas").each(function(index, element) {
var speed = $(element).data('speed');
var initialTop = $(element).data('initialtop');
$(element).css('top', initialTop-(scrollTop*speed));
});
}
The problem is that it flickers the .divCancas a few pixels to the top or bottom depending if I'm scrolling to top or down.
I tracked the TOP value passed on $(element).css('top', initialTop-(scrollTop*speed)); and it's every time correct. The correct "TOP" value, eventhough webkit move it for a few milleseconds to the wrong position.
I tried also:
-"margin-top" rather than "top" with no difference.
-Removing all other objects and making the ".each" loop through only one div, so I guess is not a jQuery performance issue.
Has anyone came across this problem?
Many thanks
Diego
Maybe try using some of the -webkit css animation features... these run very smoothly on iOS devices. Here's a great demo of that (webkit only): http://jibjub.com/demo/HTML5/cube.html

BlackBerry RichMapField is blank on device

I use RichMapField like below to display Blackberry Maps in my application.
RichMapField map = MapFactory.getInstance().generateRichMapField();
add(map);
The map is displayed properly on the BlackBerry simulator, but on a device the map field is blank.
Edited:
This is some part of my code. The code given below adds 2 markers to the map, which works perfectly fine, but the only problem is i don't see the map.
MapLocation Location1 = new MapLocation(coordinates[0],coordinates[1],"Location 1",null);
int Location1ID = data.add((Mappable)Location1,"Location 1");
data.tag(Location1ID, "Location1");
MapLocation Location2 = new MapLocation(coordinates[0]-0.00009,coordinates[1]- 0.00009,"Location 2",null);
int Location2ID = data.add((Mappable)Location2,"Location 2");
data.tag(Location2ID, "Location2");
data.setVisible("Location");
map.getMapField().update(true)
Add the following:
map.getAction().setCentreLatLon(coordinates[0],coordinates[1]);
map.getAction().setZoom(0);
I think this way you will see the map now. For some reason I'm still investigating, the map.getAction().update(true);
isn't working well for me too.
depends on your screen painting method. If your override your screen in such a way that u repaint ur screen on top of ur map, you obviously cant see the map.
Can you try pasting more code and ur paint method. It will help.

Resources