开发者

Resizing street view object

Hello StackOverflow'ers,

I have a (flex) app that, on the click of a button, resize a div (in javascript) at the bottom of the page and shows your position in google street view in it.

The things is that if I open the browser at 80% of width, click on the button and then maximize the window, the div won't take 100% of width. I have a function that his being called 'onResize' on the body tag of the page, but it doesn't seems to work. Here is the code :

...

function handleResize()
{
 document.getElementById('streetviewDiv').style.width='100%';
}

...

<body onResize="handleResize()">

How can I achieve the auto-resize of the street view? There must be a specific id for that object so that we could get it b开发者_StackOverflow中文版y javascript, but I haven't found it.

Thanks


The following works for me. You need to include jQuery-UI.

$("#streetViewDivId").resizable({handles: 'n,w,s,e', minWidth: 200, maxWidth: 600});    

$("#streetViewDivId").on( "resizestop", function( event, ui ) {

    google.maps.event.trigger(panorama, 'resize');

    console.log('streetview resize ended');
});


You're going to have to show some of the markup and CSS. There could be any number of reasons why you're not getting a resize. Normal DIV behavior is, absent any width setting, to expand horizontally to fill the parent container. So either your div is being constrained by a parent element or something else weird is going on.

It could also so happen that the div is expanding but its visible contents is not, if your StreetView object is what you expect to expand but doesn't.


I think its's pure Javascript as of v3 of the api.

this helped me: https://developers.google.com/maps/documentation/javascript/reference#StreetViewPanorama

resize None Developers should trigger this event on the panorama when its div changes size: google.maps.event.trigger(panorama, 'resize').

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜