javascriptjqueryjvectormapshadowbox

Shadowbox.js opening but not display simple <div> content


Ive created a world map using JVectorMap and am wanting to open a box using Shadowbox.js displaying various information about each highlighted country - In this example it's specifically MENA countries.

The map works and the pop-up works but my div <div>TEST</div> is not displaying at all, I am getting an error: "It may have been moved, edited or deleted."

Heres my code:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>jVectorMap</title>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" type="text/css" href="shadowbox.css">
  <link rel="stylesheet" href="jquery-jvectormap-2.0.5.css">
  
  <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  
  <script src="jquery-jvectormap-2.0.5.min.js"></script>
  <script src="jquery-jvectormap-world-mill-en.js"></script>
  <script src="shadowbox.js"></script>
  <script type="text/javascript">
    Shadowbox.init({
    language: 'en',
    players: ['iframe','html']
    });
    </script> 
</head>

<body>
  <div id="world-map" style="width: 600px; height: 400px"></div>
  <script type="text/javascript">

    $(function(){
      
      var codes = ['DZ','EG','IR','IQ','IL','JO','KW','LB','LY','MA','OM','QA','SA','TN','AE','YE'];
      
      $('#world-map').vectorMap({
        map: 'world_mill_en',
        zoomMax: 20,
        backgroundColor: '#505050',
        regionStyle: {
          initial: {
            fill: '#F6F5F4'
          },
          hover: {
            fill: '#F6F5F4',
            "fill-opacity": 1
          },
          selected: {
            fill: '#7B8B9B'
          },
          selectedHover: {
            cursor: 'pointer',
            fill: '#002142'
          }
        },
        selectedRegions: ['DZ','EG','IR','IQ','IL','JO','KW','LB','LY','MA','OM','QA','SA','TN','AE','YE'], onRegionClick: function (event, code) {
          if($.inArray(code,codes) > -1) {
            Shadowbox.open({
              content:    '<div>TEST</div>',
              title:      "MENA",
              player:     "iframe",
              height:     400,
              width:      640
            });
          }
        }
      });
    });
    </script>

</body>
</html>

Further down the line Id like to have a different message for each code but for now I'd just like to get this working.

Any help appreciated.


Solution

  • I figured it out and was something that should not have taken this long. Since I want the shadowbox to display html I needed the html player:

    player:     "html",
    

    Everything worked after that.