小编Joh*_*ith的帖子

:before,:after和padding

我有以下css代码:

.readMore:before {
    content: '';
    display: block;
    float: left;
    width: 10px;
    height: 27px;
    margin: 0;
    background: red url('images/button.png');
    background-position: 0 0;
}

.readMore {
    float: left;
    height: 24px;
    background: url('images/button.png');
    background-position: -10px 0;
    border: 0;
    margin: 0;
    padding: 4px 0 0 0;
    cursor: pointer: 
}

.readMore:after {
    content: '';
    display: block;
    float: right;
    width: 10px;
    height: 27px;
    margin: 0;
    top: -3px;
    background: red url('images/button.png');
    background-position: -411px 0;
}
Run Code Online (Sandbox Code Playgroud)

哪个样式的链接看起来像这样: 在此输入图像描述

但是当试图在垂直方向上调整.readMore中的文本时:before和:after图像也会"跳跃"下来.这是合乎逻辑的,但有没有解决方案,以便更好地与"总图像"对齐?

css image padding hyperlink

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

值为NULL Codeigniter

我试图创建以下语句(有效):

SELECT id, COUNT(*) AS item_count FROM message WHERE user_id_to = '1' AND read_date IS NULL GROUP BY message_id
Run Code Online (Sandbox Code Playgroud)

使用Codeigniters Active Record.我的代码看起来像这样:

$this->db->select('id');
$this->db->from('message');
$this->db->where('user_id_to', $this->session->userdata('id'));
$this->db->where(array('read_date' => NULL));
$this->db->group_by('message_id');
echo $this->db->count_all_results();
Run Code Online (Sandbox Code Playgroud)

我已检查过$ this-> session-> userdata('id')输出与我的"常规"SQL语句相同的ID,它是正确的.

奇怪的是,我的"常规"语句返回2,这是正确的.但我的Codeigniter statmenet返回3,这显然是错误的.

我究竟做错了什么?

php sql activerecord codeigniter

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

将值更改为占位符(输入字段)

我想用jQuery将value属性更改为占位符.所以结果将是这样的

原版的

<input type="text" value="Enter name" />
Run Code Online (Sandbox Code Playgroud)

我想改变的是什么

<input type="text" placeholder="Enter name" />
Run Code Online (Sandbox Code Playgroud)

我只找到了改变""之间的实际文本的解决方案,而不是之前的文本.所以replaceWith,replaceAll似乎不起作用.

有人知道如何解决这个问题?

jquery replace

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

clone()无法使用Internet Explorer 8

我有这个代码:

openPopup.hide();

var substr = popupId.split('-');                        
var clone = $("#popup"+substr[1]).clone(true);

$("#popup"+substr[1]).remove();
$(openPopup).html(clone);
$.dimScreenStop();
Run Code Online (Sandbox Code Playgroud)

它适用于IE 7,IE 9,Chrome,Firefox.

我已将问题追踪到" var clone = $("#popup"+ substr [1])."clone(true); " 一行.这通过添加" alert("Test"); "在所有行之间和该行之后(在IE8中)它不输出警报.

奇怪的是我在jquery min-file中遇到错误(仅在IE8中没有其他浏览器或浏览器版本):

SCRIPT5007:无法获取属性'nodeType'的值:object为null或undefined jquery.min.js?ver = 3.4.1,line 2 character 4426

jquery internet-explorer clone

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

密码盐和PBKDF2

我正在研究有关在数据库中存储密码的不同解决方案。读了很多书后,我想我最终会得到PBKDF2

尽管我对是否应该向 PBKDF2 函数输入盐并将盐存储在一列中并将 PBKDF2 密码存储在另一列中有点困惑。

我还使用 CodeIgniter 并找到了 PBKDF2 的库(https://github.com/HashemQolami/CodeIgniter-PBKDF2-Library),该库声称我不需要单独存储盐。

使用$pbkdf2['hash']推荐的用户密码注册用户;无需单独储存用户的盐。

https://github.com/HashemQolami/CodeIgniter-PBKDF2-Library#step-2

因此,如果我假设正确,我所需要的只是向函数提供密码,然后该函数会处理其余的事情?

passwords codeigniter pbkdf2 codeigniter-2

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

将列表中的多个不同元素悬停,显示单个图像

我尝试完成您将鼠标悬停在不同图像上的元素列表。

像这样的东西

<ul id="test">
 <li id="sidebarList_1">Image 1</li>
 <li id="sidebarList_2">Image 2</li>
 <li id="sidebarList_3">Image 3</li>
<ul>


<div id="imgDiv_1">
    <img src="http://www.freemacware.com/wp-content/images/smultron1.png" />
</div>
<div id="imgDiv_2">
    <img src="http://www.freemacware.com/wp-content/images/smultron2.png" />
</div>
<div id="imgDiv_3">
    <img src="http://www.freemacware.com/wp-content/images/smultron3.png" />
</div>
Run Code Online (Sandbox Code Playgroud)

我的 jQuery 看起来像这样

$(this).mouseover(function() {
    $("#imgDiv_1").css('visibility','visible'); 
}),

$(this).mouseout(function() { 
    $("#imgDiv_1").css('visibility','hidden'); 
});
Run Code Online (Sandbox Code Playgroud)

正如所见,它和现在一样是静态的。我尝试了类似的方法来获取 li 中 id 元素的编号(ex sidebarList_ 1):

$(this).mouseover(function() {   
    var myString = $(this).val().split("_").pop();   
    $("#imgDiv_" + myString).css('visibility','visible'); 
}),

$(this).mouseout(function() { 
    var myString = $(this).val().split("_").pop();
    $("#imgDiv_" + myString).css('visibility','hidden'); 
});
Run Code Online (Sandbox Code Playgroud)

?但这行不通。我怎样才能完成我想要做的事情?

jquery image onmouseover

0
推荐指数
1
解决办法
3797
查看次数