Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在infowindow谷歌地图上添加jquery slimScroll_Jquery_Google Maps_Slimscroll - Fatal编程技术网

如何在infowindow谷歌地图上添加jquery slimScroll

如何在infowindow谷歌地图上添加jquery slimScroll,jquery,google-maps,slimscroll,Jquery,Google Maps,Slimscroll,这是我的剧本: // InfoWindow content var content = '<div id="iw-container">' + '<div class="iw-title">Porcelain Factory of Vista Alegre</div>' + '<div class="iw-content">' + '<

这是我的剧本:

// InfoWindow content
var content = '<div id="iw-container">' +
             '<div class="iw-title">Porcelain Factory of Vista Alegre</div>' +
                    '<div class="iw-content">' +
                      '<div class="iw-subTitle">History</div>' +
                      '<img src="images/vistalegre.jpg" alt="Porcelain Factory of Vista Alegre" height="115" width="83">' +
                      '<p>Founded in 1824, the Porcelain Factory of Vista Alegre was the first industrial unit dedicated to porcelain production in Portugal. For the foundation and success of this risky industrial development was crucial the spirit of persistence of its founder, José Ferreira Pinto Basto. Leading figure in Portuguese society of the nineteenth century farm owner, daring dealer, wisely incorporated the liberal ideas of the century, having become "the first example of free enterprise" in Portugal.</p>' +
                      '<div class="iw-subTitle">Contacts</div>' +
                      '<p>VISTA ALEGRE ATLANTIS, SA<br>3830-292 Ílhavo - Portugal<br>'+
                      '<br>Phone. +351 234 320 600<br>e-mail: geral@vaa.pt<br>www: www.myvistaalegre.com</p>'+
                    '</div>' +
                    '<div class="iw-bottom-gradient"></div>' +
                  '</div>';
// A new Info Window is created and set content
var infowindow = new google.maps.InfoWindow({
    content: content
});
...
google.maps.event.addListener(marker, 'click', function() {
   infowindow.open(map,marker);
});
但结果不起作用,如何修复


至少插件有一个查找新元素的超时(看起来不是),当InfoWindowHTML附加到DOM时,您必须调用插件

另外,正如@Starscream1984所说,关注你所选择的元素


看起来您可能需要将细长的滚动条放在
.iw content
上,因为滚动条是滚动的部分,而不是容器。
$(function(){
    $('#iw-container').slimScroll({
        allowPageScroll: true, 
        height: '100px',
        disableFadeOut: true
     });
});
google.maps.event.addListener(infowindow, 'domready', function(){
    $('.target_element').slimScroll({
        allowPageScroll: true, 
        height: '50px',
        disableFadeOut: true
    });
});