我有一个基本的切换开关,显示点击的div同时关闭所有其他类似的div.这很好用,切换不是问题.见下文:
$(document).ready(function(){
$('.threadWrapper > .littleme').click(function() {
$(this).next().toggle('slow');
$(this).toggle('slow');
$('.littleme').not(this).next().hide('slow');
$('.littleme').not(this).show('slow');
return false;
}).next().hide();
});
Run Code Online (Sandbox Code Playgroud)
我也使用了jQuery的Masonry插件,它可以组织所有选定的div元素,然后垂直地组织.辉煌,适用于各种不同的div高度.见下文:
$(function(){
$('#mainContent').masonry({
columnWidth: 200,
itemSelector: '.threadWrapper:visible',
});
});
Run Code Online (Sandbox Code Playgroud)
我想要它做的是每次div扩展或折叠时重新组织布局.实际上触发.masonry命令作为初始.click函数的回调.这对我不起作用.适用于初学者的问题.
了解它目前如何在这里工作:kalpaitch.com
安德鲁
Gaby - 感谢语法检查,我非常善于将这些人弄松,然后花了大约半个小时的时间来寻找它们.
Cyro - 这是完美和有效的,我将在不久的将来使用它.我想要添加的是在显示/隐藏/切换这些动画速度的情况下如何实现这一点(上面的代码相应地改变).然后,在扩展div之前将触发砌体调用(目前正在kalpaitch.com上发生).非常感谢答案,但这种方式肯定更容易.
我有以下字符串和正则表达式:
var string = "Dear [to name], [your name] has decided to share this [link]";
var patt = /\[+[A-Za-z0-9]+\]/;
Run Code Online (Sandbox Code Playgroud)
我希望能够使用动态输入更改每个括号中的变量.我如何使用match()或replace()定位此正则表达式的第1,第2和第3次出现?
编辑:目前,如果我这样做的东西document.write(body.match(patt));只匹配最后一个[链接]
编辑:整个字符串取自文本框的值.每个括号的值都取自其他文本输入,需要在将文本放回文本框之前插入到字符串中.
我有以下数组.我需要通过嵌套数组键[id]对此数组进行排序:
Array (
[0] => Array ( [id] => 5 [category_id] => 12 )
[1] => Array ( [id] => 3 [category_id] => 12 )
[2] => Array ( [id] => 9 [category_id] => 12 )
[3] => Array ( [id] => 4 [category_id] => 12 )
)
Run Code Online (Sandbox Code Playgroud) 无论如何ping一个电子邮件地址或类似的事情来检查它是一个真正的工作地址.我不是在谈论正则表达式或php验证过滤器等,但实际检查地址存在?
如何ia)包括一个在Web根目录之外的php脚本(它真的只是一个简单的../file.php),b)将表单数据发布到Web根目录之外的php脚本.我被引导相信这是php安全的基石.
我在表单中有一个字符串,$string = 'London,Paris,Birmingham'我想搜索多个列以查找这些值的出现.
例如 WHERE events.name, events.cities, events.counties IN (".($string).")
有人可以推荐我一个简单而简短的方法来做这样的事情.
我遇到了Internet Explorer没有在CSS属性列表中应用最后一个属性的问题.是否有必要;从CSS属性列表中省略最后一个?例如:
.style { width: 100px; height: 100px }
Run Code Online (Sandbox Code Playgroud)
还是真的没关系?
我刚从php 5.1升级到5.3,之前在我的服务器上使用了cakephp 1.1.自升级(或可能更早,我无法确定),我收到以下错误.任何人都可以解释一下:
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/dispatcher.php on line 157
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/dispatcher.php on line 221
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/controller/controller.php on line 308
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/controller/controller.php on line 347
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/controller/controller.php …Run Code Online (Sandbox Code Playgroud) 在5.2之前的php版本中是否有使用json_decode函数的简单替代方法?我在这个夜晚的时候感到很懒,并且不能再次更新php了.干杯.
我继承了一个有三个领域的可爱模式:id, field_name, field_value.现在您可以看到它是如何工作的,对于通过CMS添加的每个字段,它都被添加为新行,而id值不是唯一的.
但是每个字段不是单个实体,它们实际上应该按id(它引用已提交的表单的实例)进行分组.作为旁注,我有兴趣知道这个模式模式可能被调用了什么?
//example db contents
1 name Joe Blogs
1 email joe@example.com
1 programme sport
2 name Dave
2 email dave@example.com
2 programme art
Run Code Online (Sandbox Code Playgroud)
当然,我真的希望使用一个查询来获取按id字段分组的选定字段.输出array( id => array( 'field' => 'value' , 'field' => 'value' ) )等
通常我会在下面做,但我想知道是否有一种纯SQL方法可以做到这一点,切断循环并在底部处理.
$existing = new stdClass;
$sql = "SELECT 'id','field_name','field_value'
FROM table_name";
$results = $wpdb->get_results( $sql, ARRAY ); //using wordpress btw
foreach ( $results as $k=>$r )
$existing[$r['id']][$k] = $r;
Run Code Online (Sandbox Code Playgroud)