2014-11-24 74 views
-1

我一直在努力想弄明白为什么我的JavaScript代码不能运行。我的JavaScript不会加载

有人能告诉我我错过了什么吗? :(

JSFiddle

HTML

<div class="po-markup"> 
    <br> 
    <a href="#" class="po-link">Hover me </a> 
    <div class="po-content hidden"> 
     <div class="po-title"> 
      <img src="http://g.etfv.co/http://www.cnn.com" alt="Google" width="16" height="16" /> 
      Title 
     </div> 
     <div class="po-body"> 
      <p> 
       Any Description .... 
      </p> 
     </div> 
    </div> 
</div> 

JS JS

+1

您可以将代码粘贴为* text *而不仅仅是它的截图吗? – 2014-11-24 19:57:43

+0

如果将括号/括号对齐,则会看到问题 – 2014-11-24 19:58:17

+3

感谢您提出的所有意见。有人已经指出我做错了什么。谢谢大家的帮助。 – iori 2014-11-24 20:06:04

回答

2

应关闭});

$(document).ready(function() { 

    $('.po-markup > .po-link').popover({ 
     trigger: 'hover', 
     html: true, // must have if HTML is contained in popover 

     // get the title and conent 
     title: function() { 
      return $(this).parent().find('.po-title').html(); 
     }, 
     content: function() { 
      return $(this).parent().find('.po-body').html(); 
     }, 

     container: 'body', 
     placement: 'right' 

    }); //add it 
}); 

还应该添加引导e.g 3.2.0版本

,你应该在你的代码,例如添加jQuery库在onLoad

jsfiddle

2

有许多的问题与你的jsfiddle

  • 你是不是引用的jQuery
  • 你是不是引用该 定义酥料饼库()
  • 您的Javascript构建不正确;您需要关闭该功能并拨打});