小编Bla*_*umb的帖子

什么取代了Bootstrap 3中的导航列表?

我准备更新我的网站来引导3,但我无法弄清楚如何更换nav-list从引导2类.

我查看了列表组,但我不确定这是否用于替换导航列表.如何在Bootstrap 3中使下面的标记工作?

<div class="well">
    <ul class="nav nav-list">
        <li><a href="#">Link 1</a></li>
        <li><a href="#">Link 2</a></li>
    </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

编辑

这就是我想要的样子:http://jsfiddle.net/bplumb/2Nguy/

html css twitter-bootstrap

30
推荐指数
3
解决办法
3万
查看次数

将表插入内容可编辑div

我有一个小提示,显示我的代码正在做什么.使用javascript/jquery我试图将一个表插入到当前插入位置的内容可编辑div中.我正在使用Tim Down的Rangy库来实现这一目标.我用以下javascript做这个.

var range = getFirstRange();
var el = document.createElement("table");
var tableHtml = "";
for (var a = 0; a <= tableY; a++) {
    if(a%2==0){
       tableHtml += '<tr class="zebra">';
    }
    else{
       tableHtml += '<tr>';
    }
    for (var b = 0; b <= tableX; b++) {
       tableHtml += '<td>&nbsp;</td>';
    }
    tableHtml += '</tr>';   
}
$(el).html(tableHtml); 
range.insertNode(el);
rangy.getSelection().setSingleRange(range);
Run Code Online (Sandbox Code Playgroud)

以防万一它是getFirstRange函数.

function getFirstRange() {
   var sel = rangy.getSelection();
   return sel.rangeCount ? sel.getRangeAt(0) : null;
} 
Run Code Online (Sandbox Code Playgroud)

我需要在放置此表的任何地方制作有效的html.例如,如果插入符号位于链接的中间,我试图避免以下html.

<p>some text <a href="#">text …
Run Code Online (Sandbox Code Playgroud)

javascript jquery html-table rangy

14
推荐指数
1
解决办法
2439
查看次数

PHP curl_multi_getcontent返回null

我一直在关注如何使用本教程curl_multi.http://arguments.callee.info/2010/02/21/multiple-curl-requests-with-php/

我不知道我做错了什么,但是curl_multi_getcontent返回null.假设返回JSON.我知道这不是mysql调用,因为我使用了while循环和标准curl_exec,但页面加载时间过长.(我已经更改了一些setopt详细信息以确保安全性)

相关的PHP代码段.我最后关闭了while循环.

$i = 0;
$ch = array();
$mh = curl_multi_init();
while($row = $result->fetch_object()){
   $ch[$i] = curl_init();
   curl_setopt($ch[$i], CURLOPT_CAINFO, 'cacert.pem');
   curl_setopt($ch[$i], CURLOPT_USERPWD, "$username:$password");
   curl_setopt($ch[$i], CURLOPT_RETURNTRANSFER, true); 
   curl_setopt($ch[$i], CURLOPT_URL, 'https://mysite.com/search/'.$row->username.'/');
   curl_multi_add_handle($mh, $ch[$i]);
   $i++;
}
$running = 0;
do {
    curl_multi_exec($mh, $running);
} while ($running > 0);
$result->data_seek(0);
$i = 0;
while ($row = $result->fetch_object()) {
    $data = curl_multi_getcontent($ch[$i]);
    $json_data = json_decode($data);
    var_dump($json_data);
Run Code Online (Sandbox Code Playgroud)

编辑

这是当前可用的代码,但导致页面加载速度太慢

$ch = curl_init();
curl_setopt($ch, CURLOPT_CAINFO, 'cacert.pem');
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); …
Run Code Online (Sandbox Code Playgroud)

php curl curl-multi

10
推荐指数
1
解决办法
6817
查看次数

动画同步,光标和高亮显示

所以我几乎让我的代码按照我想要的方式运行,但是无法将我的动画同步到一起.我试图设置光标突出显示文本,然后单击按钮.问题是光标太慢或太快.我试图使这个动态,所以无论文本有多长,我仍然可以让动画同步.我知道这可能只是一个数学问题,但不能完全理解它.试图用毫秒来匹配像素的东西让我头晕目眩.在拉出我所有的头发之前请帮忙.谢谢.

这是html

<p><span id="container">I need to be highlighted one character at a time</span>
<input id="click" type="button" value="click me"/></p>
<img src="http://dl.dropbox.com/u/59918876/cursor.png" width="16"/>
Run Code Online (Sandbox Code Playgroud)

这是CSS

#container{
   font-size: 16px;  
   margin-right: 10px;   
}
.highlight{
    background: yellow;           
}
img{
  position: relative;
  top: -10px;    
} 
Run Code Online (Sandbox Code Playgroud)

和javascript

function highlight(){
    var text = $('#container').text(); //get text of container
    $('#click').css('border','none'); //remove the border
    $('img').css('left', '0px'); //reset the cursor left
    $('img').animate({left: $('#container').width() + 40}, text.length*70); //animation of cursor
    $('#container').html('<span class="highlight">'+text.substring(0,1)+'</span><span>'+text.substring(1)+'</span>'); //set the first html
    (function …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery animation

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

获取元素的所有父元素,包括元素本身

我正在尝试创建一个包含用户在内容可编辑div中单击的所有元素的数组.我使用以下代码.

 var els = [];
 var target = event.target;
 while (target){ //Create an array of parent elements
    els.push(target); //Push target to the back of the array
    target = target.parentNode; 
}
Run Code Online (Sandbox Code Playgroud)

但我想知道我是否可以使用jQuery将其减少到一行.jQuery .parents()几乎让我在那里,但它不包括第一个event.target

var els = $(event.target).parents();
Run Code Online (Sandbox Code Playgroud)

有没有办法包含元素本身.parents()或有更好的方法来做到这一点?

javascript jquery

2
推荐指数
1
解决办法
967
查看次数

Flot:显示最小刻度数

使用浮点图,我想指定在 y 轴上显示的最小刻度数。就我而言,我希望始终显示至少 10 个刻度(值 1-10),但如果我的 y 轴最大值超过 10,那么我希望 flot 使用正常刻度算法绘制图表。我目前通过为刻度参数指定一个函数来实现它的工作。

ticks: function(axis){
           var ticks = [];
           if(axis.max < 10){
                ticks = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
           }
           else{
             for(var i = 1; i < axis.max; i++){
                 ticks.push(i);
             }
           }
           return ticks;
}, 
Run Code Online (Sandbox Code Playgroud)

这样做的问题是,当 大于 10 时,我得到的刻度数比我想要的多得多。axis.max有没有办法避免这种情况?

我原本以为我可以返回 null,但 flot 期望返回一个数组。:(

javascript jquery flot

2
推荐指数
1
解决办法
4432
查看次数

SVG 在移动 Safari 中呈现较小

我正在创建一个自定义 SVG 按钮,但我不明白为什么在移动 Safari 中我的图标呈现得比所有其他浏览器小得多。

超文本标记语言

<button>
  <svg viewBox="0 0 24 24">
      <path d="M22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM12.5 8H11v6l4.75 2.85.75-1.23-4-2.37V8zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/>
  </svg>
</button>
Run Code Online (Sandbox Code Playgroud)

CSS

button {
  /* Button Reset */
  border: none;
  outline: none;
  margin: 0;
  width: auto;
  overflow: visible;
  background: transparent;
  /* inherit font & color from ancestor */
  font: inherit;
  /* Corrects font …
Run Code Online (Sandbox Code Playgroud)

html css svg mobile-safari

2
推荐指数
1
解决办法
1946
查看次数