Leaflet - Tabs in Popups

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Leaflet - Tabs in Popups

    Hallo zusammen,

    ich habe folgendes Tutorial gefunden mit dem ich gerade versuche in meine Leaflet-Popups "Tabs" zu realisieren:
    dynamicdrive.com/dynamici...tabcontent.htm

    Hier in Link zu meiner Leaflet-Karte:
    test.rettertest.square7.de/

    Mein Code sieht folgendermaßen aus:

    HTML-Quellcode

    1. <!DOCTYPE html>
    2. <html>
    3. <head>
    4. <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    5. <title>TEST</title>
    6. <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4/leaflet.css" />
    7. <!--[if lte IE 8]>
    8. <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4/leaflet.ie.css" />
    9. <![endif]-->
    10. <style type="text/css">
    11. div#map div.gmnoprint div{overflow-x: hidden !important;}
    12. .author {font-family:Arial;font-size:x-small;}
    13. div#content {margin:0px;max-width:300px;overflow:hidden;}
    14. .content {margin:0px;max-width:300px;height:400px;overflow:hidden;}
    15. div#bild {margin:0px;width:300px;max-width:300px;height:200px;}
    16. .LINE1 {font-family:Arial;font-size:large;font-weight:bold;display:block;max-width: 300px;margin-bottom:inherit;line-height: 1.5;}
    17. .LINE2 {font-family:Arial;font-size:x-small;display:block;max-width: 300px;line-height: 1.5;}
    18. .LINE3 {font-family:Arial;font-size:small;font-weight:bold;display:block;max-width: 300px;line-height: 1.5;}
    19. .LINE4 {font-family:Arial;font-size:small;display:block;max-width: 300px;line-height: 1.5;}
    20. #map { height: 600px; }
    21. </style>
    22. <link rel="stylesheet" type="text/css" href="tabcontent.css" />
    23. <script type="text/javascript" src="tabcontent.js">
    24. /***********************************************
    25. * Tab Content script v2.2- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    26. * This notice MUST stay intact for legal use
    27. * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    28. ***********************************************/
    29. </script>
    30. <script src="http://cdn.leafletjs.com/leaflet-0.4/leaflet.js"></script>
    31. <script type="text/javascript"
    32. src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js">
    33. </script>
    34. <script type="text/javascript">
    35. function load() {
    36. var dahwIcon = L.icon({
    37. iconUrl: '/img/logo.png',
    38. shadowUrl: '/img/mm_20_shadow.png',
    39. iconSize: [23, 23], // size of the icon
    40. shadowSize: [30, 30], // size of the shadow
    41. shadowAnchor: [10, 20], // the same for the shadow
    42. });
    43. var map = L.map('map').setView([51.165691, 10], 7);
    44. // L.tileLayer('http://{s}.tile.cloudmade.com/a2f724a704d34552bf6c6ce5fc654b4b/22677/256/{z}/{x}/{y}.png', {
    45. // attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
    46. // maxZoom: 25
    47. L.tileLayer('http://{s}.tile.cloudmade.com/a2f724a704d34552bf6c6ce5fc654b4b/997/256/{z}/{x}/{y}.png', {
    48. maxZoom: 18,
    49. attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>'
    50. }).addTo(map);
    51. var firstLoad = true;
    52. $.getJSON("get_info.php", function (data) {
    53. for (var i = 0; i < data.length; i++) {
    54. var location = new L.LatLng(data[i].breitengrad, data[i].laengengrad);
    55. var name = data[i].name;
    56. var address = data[i].address;
    57. var type = data[i].type;
    58. var ts = data[i].ts;
    59. var orts_id = data[i].orts_id;
    60. var Anrede = data[i].Anrede;
    61. var Vorname = data[i].Vorname;
    62. var Nachname = data[i].Nachname;
    63. var Tel = data[i].Tel;
    64. var EMAIL = data[i].EMAIL;
    65. var Internet = data[i].Internet;
    66. if (type != "1") { var orts_id = "undefined" }
    67. if (EMAIL != "") { var EMAIL = "<a href='mailto:"+ EMAIL +"'>" + EMAIL + "</a>" } else {var EMAIL = "<a href='mailto:test@test.de'>test@test.de</a>" }
    68. if (Tel != "") { var Tel = Tel } else {var Tel = "1234/56789" }
    69. if (Internet != "") { var Internet = "<a href='"+ Internet +"' 'target=_blank'>" + Internet + "</a>" } else {var Internet = "<a href='http://www.TEST.de' target='_blank'>www.TEST.de</a>" }
    70. var marker = new L.Marker(location, {icon: dahwIcon, title: name});
    71. marker.bindPopup('<div style="border:1px solid gray; width:300px; height: 350px; background-color: #EAEAEA; padding: 5px">'+
    72. '<div id="tcontent1" class="tabcontent">'+
    73. 'Tab content 1 here<br />Tab content 1 here<br />'+
    74. '</div>'+
    75. '<div id="tcontent2" class="tabcontent">'+
    76. 'Tab content 2 here<br />Tab content 2 here<br />'+
    77. '<div class="LINE1">'+name+'</div>'+
    78. '<span class="LINE2">von <a href="http://www.TEST.de" target="_blank">TEST</a> am ' + ts + ' aktualisiert </span>'+
    79. '<div class="bild"><img src="/karte/images/'+orts_id+'.jpg" border="1" alt='+name+'/></div>'+
    80. '<span class="LINE3">Kontakt:</span>'+
    81. '<span class="LINE4">' + Anrede + ' ' + Vorname + ' ' + Nachname + '</span>'+
    82. '<span class="LINE4">Telefon: ' + Tel + '</span>'+
    83. '<span class="LINE4">E-Mail: ' + EMAIL + '</span>'+
    84. '<span class="LINE4">Internet: ' + Internet + '</span>'+
    85. '</div>'+
    86. '</div>'+
    87. '<div id="flowertabs" class="modernbricksmenu2">'+
    88. '<ul>'+
    89. '<li><a href="#" rel="tcontent1" class="selected">Übersicht</a></li>'+
    90. '<li><a href="#" rel="tcontent2">Beschreibung</a></li>'+
    91. '<li><a href="http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm">Tab Content</a></li>'+
    92. '</ul>'+
    93. '</div>'+
    94. '<br style="clear: left" />'+
    95. '<scr'+'ipt type="text/javascript">' +
    96. 'var myflowers=new ddtabcontent("flowertabs")'+
    97. 'myflowers.setpersist(true)'+
    98. 'myflowers.setselectedClassTarget("link")'+
    99. 'myflowers.init()</scr'+'ipt>', {maxWidth:'300'});
    100. map.addLayer(marker);
    101. }
    102. }).complete(function() {
    103. if (firstLoad == true) {
    104. map.fitBounds(map.getBounds());
    105. firstLoad = false;
    106. };
    107. });
    108. }
    109. </script>
    110. </head>
    111. <body onload="load()">
    112. <div id="map" style="width: 500px; height: 600px"></div>
    113. </body>
    114. </html>
    Alles anzeigen



    Leider kann ich die Tabs, nachdem ich auf einen Marker klicke, nicht auswählen, als ob das benötigte Script einfach nicht ausgeführt werden würde.
    Woran liegt das?

    Ich hoffe jemand von euch kann jemand helfen

    Ich freue mich über jede Antwort.

    Viele Grüße und Vielen Dank
    Adrjan