Google Maps API V3 InfoBox using jQuery fadeIn and fadeOut

后端 未结 6 1243
Happy的楠姐
Happy的楠姐 2021-02-06 05:18

I have searched the web high and low and have not been able to find a tutorial or example of using jQuery to fade an InfoBox/InfoWindow in Google Maps not the content the actual

6条回答
  •  情话喂你
    2021-02-06 06:02

    The fadeOut effect can be achieved by adding class and setTimeout. Let me explain.

    For example:

    $('.close-el')
            .on('click', function(e) {
                e.stopPropagation();
                $(infobox.div_).addClass('is-closing');
                setTimeout(function() {
                    infobox.close();
                }, 700);
        }); 
    

    when you add CSS class, and, after end of css transition you close the info box

    and CSS (sass) (.infoBox is reserved class)

    .infoBox {
        &.is-closing {
            transition: transform 400ms, opacity 400ms;
    
            transform: translate3d(0, 30px, 0);
            opacity: 0;
        }
    }
    

提交回复
热议问题