jsfiddle of Google Street View Problem here: https://jsfiddle.net/d8qgfcvf/4/
jsfiddle of my sad attempt to simulate how a normal Google map does it by embedding the z-index element on top of it so that it can scroll when above StreetViewPanorama, but this example cannot drag StreetView, as you can drag a regular map: https: / /jsfiddle.net/Ltjz44gg/3/
Well, battled this scroll issue in viewing Google Maps in StreetViewPanorama. Since I use both the main map and StreetViewPanorama. Here is the basic information about my code:
var theMapOptions =
{
backgroundColor : "#B0C0C6",
zoom : 16,
maxZoom : 20,
minZoom : 2,
disableDefaultUI : true,
center : new google.maps.LatLng(Property.map['lat'], Property.map['lng']),
mapTypeId : google.maps.MapTypeId.ROADMAP,
mapTypeControl : false,
zoomControl : true,
panControl : true,
streetViewControl : true,
panControlOptions: {
position: google.maps.ControlPosition.TOP_LEFT
},
zoomControlOptions: {
style : google.maps.ZoomControlStyle.LARGE,
position: google.maps.ControlPosition.TOP_LEFT
}
};
var theStreetMapOptions =
{
position : new google.maps.LatLng(Property.map['lat'], Property.map['lng']),
pov: {
heading: 135,
pitch: -10
},
scrollwheel: false,
motionTrackingControlOptions: {
position: google.maps.ControlPosition.LEFT_BOTTOM
}
};
var theMap = new google.maps.Map(document.getElementById('mapID'), theMapOptions);
theMap.setOptions({styles: styles});
var theMapMarkerOptions =
{
map : theMap,
position : new google.maps.LatLng(Property.map['lat'], Property.map['lng']),
draggable : false,
visible : true
}
var theMapMarker = new google.maps.Marker(theMapMarkerOptions);
theMapMarker.Map = theMap;
theMapMarker.setMap(theMap);
var theStreetMap = new google.maps.StreetViewPanorama(document.getElementById('map-street'), theStreetMapOptions);
theMap.setStreetView(theStreetMap);
scrollwheel -, StreetViewPanorama. , div , , Google , :
id of map-street - , StreetViewPanorama Map.
HTML:
<div id="mapID" class="col-xs-24 col-md-12"></div>
<div id="map-street" class="col-xs-24 col-md-12"><div class="block-scrolling fade"><p></p></div></div>
:
.transition (@transition) {
-webkit-transition: @transition;
-moz-transition: @transition;
-ms-transition: @transition;
-o-transition: @transition;
}
.block-scrolling {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,.3);
z-index: 2;
.transition(all .25s linear);
p {
position: relative;
text-align: center;
top: 50%;
transform: translateY(-50%);
color: white;
font-size: 26px;
}
}
JQuery
$(document).on('keydown keyup', function(e) {
var io = e.type == 'keydown' ? 0 : 1;
if ((e.ctrlKey || e.metaKey) && $('.block-scrolling').data('mouseover')) {
e.preventDefault();
console.log($('.block-scrolling').data('mouseover'));
if (io === 0)
$('.block-scrolling').css({zIndex: -1});
else
$('.block-scrolling').removeClass('in').css({zIndex: 2});
return false;
}
else
$('.block-scrolling').css({zIndex: 2});
return true;
});
$(".block-scrolling").mouseenter(function() {
clearTimeout($(this).data('timeoutId'));
$(this).data('mouseover', true);
}).mouseleave(function(){
var scrollingElement = $(this),
timeoutId = setTimeout(function(){
scrollingElement.data('mouseover', false);
}, 50);
scrollingElement.data('timeoutId', timeoutId);
});
$(".block-scrolling").on('scroll wheel DOMMouseScroll mousewheel touchstart', function(e) {
var $this = $(this),
$text = e.type == 'touchstart' ? 'Use two fingers to move the map' : (e.type == 'wheel' ? 'Use ⌘ + scroll to zoom the map' : 'Use Ctrl + scroll to zoom the map');
clearTimeout($.data(this, 'scrollTimer'));
$this.find('p').html($text);
$this.addClass('in');
var scrollingElement = $(this);
if (e.type == 'touchstart')
{
if (e.hasOwnProperty('touches') && e.touches.length && e.touches.length > 1)
$this.css({zIndex: -1});
}
$.data(this, 'scrollTimer', setTimeout(function() {
scrollingElement.removeClass('in');
}, 2000));
});
jquery , google , , , google ( ), . , , , , , css--, jQuery, .
, , scrollwheel: false - - , StreetViewPanorama Map (map-street) . , , Google Maps, , scrollwheel: false. scrollwheel: false, Panorama View .
StreetViewPanorama ( StreetView)?
, , Google Maps, ( ), (, Google )?
, . StreetViewPanorama, block-scrolling div, , , ( StreetViewPanorama).