小编Dan*_*.K.的帖子

Bootstrap popover内容无法动态更改

我使用如下代码:

$(".reply").popover({
  content: "Loading...",
  placement: "bottom"
});

$(".reply").popover("toggle");
Run Code Online (Sandbox Code Playgroud)

这正确地创建了popover及其内容.我想在不关闭弹出窗口的情况下将新数据加载到弹出框中.

我尝试过以下方法:

var thisVal = $(this);
$.ajax({
  type: "POST",
  async: false,
  url: "Getdes",
  data: { id: ID }
}).success(function(data) {
  thisVal.attr("data-content", data);
});
Run Code Online (Sandbox Code Playgroud)

在此调用之后,元素中的数据将被更改,但不会显示在显示的弹出框中.

我该怎么办?

jquery popover twitter-bootstrap

59
推荐指数
5
解决办法
7万
查看次数

在Rails 3升级后rake db:test:准备不工作?

我刚刚完成了升级使用测试单元到Rails 3.1.rc4的Rails 2.3.11应用程序的过程,现在我已经设置了rspec-rails 2.6.1.

我还将测试连接切换database.yml为使用sqlite而不是postgres.

我可以运行rake db:migratedb:test:prepare所有的日子,但在我的模型试验,我得到"找不到表'模型名称’".

还有其他人遇到过这个吗?

rake rspec rspec2 ruby-on-rails-3

7
推荐指数
1
解决办法
1590
查看次数

我怎样才能捕获:IE8中的内容之后?

我正在将一个:after伪元素应用于显示我的媒体查询断点名称的正文,如下所示:

body::after {
  content: 'medium';
  display: none;
}
Run Code Online (Sandbox Code Playgroud)

这样做的原因可以在这里找到:http://adactio.com/journal/5429/

我想获得:after在IE8 中使用javascript 的内容值.

这是我为其他浏览器做的方式:

var breakpoint = window.getComputedStyle(document.body, ':after').getPropertyValue('content');
Run Code Online (Sandbox Code Playgroud)

但IE8不支持getComputedStyle(),我知道它支持currentStyle,但经过一些尝试后我无法正确使用它.

这是我尝试没有成功的事情:

var breakpoint = document.body.currentStyle.getPropertyValue('content');
Run Code Online (Sandbox Code Playgroud)

有人知道怎么做吗?

编辑: 在BoltClock的笔记之后我现在已经将我的css改为此(一个半冒号):

body:after {
  content: 'medium';
  display: none;
}
Run Code Online (Sandbox Code Playgroud)

在使用两个之前,内容甚至没有出现在IE8中,所以它没有任何回报.不幸的是我仍然无法让IE8返回内容.

我在尝试这个:

if (style = document.body.currentStyle) {
  for (var prop in style) {
    if (prop === 'content') {
      alert(prop);
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我什么都没得到,但是如果我换'content'了一些其他的财产'backgroundColor'就会发出警告.所以我想即使msdn将内容列为currentStyle http://msdn.microsoft.com/en-us/library/ie/ms535231%28v=vs.85%29.aspx的可用属性之一,它也不会实际上是回归它,除非我做错了什么.

javascript css internet-explorer-8

7
推荐指数
1
解决办法
1750
查看次数