我正在寻找一种在页面加载时自动"点击"项目的方法.
我试过用了
$("document").ready(function() {
$("ul.galleria li:first-child img").trigger('click');
});
Run Code Online (Sandbox Code Playgroud)
但它似乎没有用?但是,当我进入$("ul.galleria li:first-child img").trigger('click');Firebug的控制台并运行脚本时,它可以工作.
触发事件可以在加载时使用吗?
我有一个奇怪的问题,将一组div放在另一个div中.我认为用图像描述它最好:
在黑色(#box)div内,有两个div(.a,.b)必须放在同一个地方.我想要实现的是第一张图片,第二张是我得到的效果.看起来如果div没有清除或什么东西浮动,显然不是这种情况.任何想法都会受到欢迎!
这是此示例的代码:
CSS:
#box {
background-color: #000;
position: relative;
padding: 10px;
width: 220px;
}
.a {
width: 210px;
position: absolute;
top: 10px;
left: 10px;
background-color: #fff;
padding: 5px;
}
.b {
width: 210px;
position: absolute;
top: 10px;
left: 10px;
background-color: red;
padding: 5px;
}
#after {
background-color: yellow;
padding: 10px;
width: 220px;
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<div id="box">
<div class="a">Lorem</div>
<div class="b">Lorem</div>
</div>
<div id="after">Hello world</div>
Run Code Online (Sandbox Code Playgroud) 
我在链接元素上添加了一个内部图像的填充问题.它发生在所有浏览器,Safari,Firefox,IE中.
我有一个重置样式表应用,所以在填充上不应该有任何额外的边距,但在检查时,很明显该a元素有一些额外的底部填充从无处.有任何想法吗?
这是标记和CSS:
<div class="movie"><a href=""><img src="img/video01.jpg" alt="" /></a></div>
div.home-col .movie {
padding: 0 0 11px 0;
background: url(../img/bg-shadow-movie.png) bottom no-repeat;
}
div.home-col .movie a {
display: block;
background: url(../img/bg-zoom-movie.png) 50% 5px no-repeat;
}
div.home-col .movie img {
padding: 4px;
margin: 0;
border: 1px solid #d0d0d0;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在WordPress的自定义元框中添加一个复选框,我遇到了保存它的问题 - 每当我选中复选框并更新帖子/页面时,它都会再次取消选中.
这是我正在使用的代码:
add_meta_box(
'sl-meta-box-sidebar', // id
'Sidebar On/Off', // title
'sl_meta_box_sidebar', // callback function
'page', // type of write screen
'side', // context
'low' // priority
);
function sl_meta_box_sidebar() {
global $meta; sl_post_meta( $post->ID ); ?>
<input type="checkbox" name="sl_meta[sidebar]" value="<?php echo htmlspecialchars ($meta['sidebar']); ?>" />Check to turn the sidebar <strong>off</strong> on this page.
}
Run Code Online (Sandbox Code Playgroud)
这会在"编辑页面"屏幕的侧边栏中创建复选框,因为它应该没问题.我不确定我应该在复选框的值中输入什么,文本字段显然会返回保存为元信息的内容...我尝试使用"已检查"而不是因为这将是我的第一个猜测(然后只需检查对于使用此元数据时的值,但它也没有保存复选框.
这是保存所有元数据的函数,我假设这会导致此问题:
function sl_save_meta_box( $post_id, $post ) {
global $post, $type;
$post = get_post( $post_id );
if( !isset( $_POST[ "sl_meta" ] ) )
return; …Run Code Online (Sandbox Code Playgroud) 我一直在使用:之前或之后的CSS技巧(在本文中解释:http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-multiple-borders-with-simple-css /)实现多个边框和背景.它在div元素上很有效,但我注意到它根本不适用于图像.
这是我的代码:
.author img {
position: absolute;
left: 10px;
background-color: #fff;
padding: 3px;
border: 1px solid #d0d0d0;
width: 48px;
}
.author img:before {
content: '';
display: block;
width: 80px;
height: 16px;
position: absolute;
top: -17px; left: 0;
background: red;
}
Run Code Online (Sandbox Code Playgroud)
有没有办法在图像上使用这个技巧,还是我必须将我的图像包装在另外的div中?
我在一些博客上找到了这段代码,它应该显示来自WordPress帖子的所有图像.
function getImage() {
global $more;
$more = 1;
$link = get_permalink();
$content = get_the_content();
$count = substr_count($content, '<img');
$start = 0;
for($i=1;$i<=$count;$i++) {
$imgBeg = strpos($content, '<img', $start);
$post = substr($content, $imgBeg);
$imgEnd = strpos($post, '>');
$postOutput = substr($post, 0, $imgEnd+1);
$postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '',$postOutput);;
if(stristr($postOutput,'<img')) { echo $postOutput; }
$start=$imgEnd+1;
}
$more = 0;
}
Run Code Online (Sandbox Code Playgroud)
但是会发生什么......它正确地显示第一和第二图像,然后循环第二个图像而不是第三个图像等.它可以抓取图像的数量,但不显示第1,第2,第3,第4个图像,它显示第1个,第2,第2,第2 ......
任何人都可以看看这个片段,也许想出为什么会发生这种情况?我知道代码相当邋,,但我只是在一些博客上找到它,作为一个PHP新手和所有:)
所有帮助表示感谢,提前感谢!
我正在使用CarouFredSel jQuery插件(http://caroufredsel.dev7studios.com)在我的网站上创建动画轮播.但是,我注意到动画是不正确的 - 它动画太过分了(与我编码的设置相比),然后在动画结束时,它会跳到正确的位置.
这是发生错误的页面:http://mnogal.pl/kopernik/html/strona_glowna.html - 文本应该始终位于中间,动画应该移动到下一个文本位于中间.
它的设置如PIC 1 - TEXT - PIC 2 - TEXT - PIC 1等,所以它应该在每个动画后交替两个图片位置,如果这是有意义的.
我最终在动画之后显示正确的东西,它只是动画太远而且在它结束之前跳跃.
我检查了侧面的演示,没有发生这种情况,我的代码似乎也正确,没有任何异常:
$("#carousel .overview").carouFredSel({
height: 507,
items: {
visible: 3,
},
scroll: {
items: 2,
duration: 3000
},
auto: 6000
});
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?我无法弄清楚这一点.
我正在为我的WordPress主题构建主题选项页面,我希望能够从列表中选择多个项目.
我使用的"一个选项"选择代码如下所示:http://pastie.org/684800,它完美无缺.
我是一个PHP新手所以我试图修改上面的代码来实现我想要的结果.这就是我想出的:pastie.org/684804.正如你所看到的,我基本上添加了一些html值,multiple="yes"希望它可以工作;)
代码正确显示选择项目,但似乎只保存最后选择的项目.有人可以就如何保存多个所选项目提出一些建议吗?
只是一个快速的新手PHP语法问题.
我有一个变量,让我们调用它$tabs,它总是包含一个用逗号分隔的数字串,如下所示:24,35,43,21
I also have a variable that's an array:
$args = array('post_type' => 'page', 'post__in' => array(27,19,29), 'order' => 'ASC');
Run Code Online (Sandbox Code Playgroud)
That's of course WordPress. What I need to do, is place the content of the $tabs variable (numbers) where the numbers inside the array are. I'm rather new to PHP, only understand how to modify some things, but this I can't figure out, no idea how the syntax for it should go.
Anyone able to help? …
我正在使用Flexslider在我正在处理的网站上创建一个非常简单的全宽幻灯片.
我的例子:http://hammr.co/3008537/4/index.html
但是,我正在寻找的是让图像始终跨越窗口的整个宽度,但在达到设定值后停止调整高度,然后只剪切图像的一侧.
这正是这里发生的事情:http://www.orient-express.com/web/orex/collection/trains/venice_simplon_orient_express.jsp - 在达到一定大小后,图像不再调整大小,只是被切断了.
我在该网站上挖掘了脚本和css,但无法弄明白.在幻灯片的任何位置设置最小高度会使它们变形,显然.我怎样才能达到这个效果?
css ×4
php ×4
wordpress ×4
jquery ×3
image ×2
animation ×1
arrays ×1
background ×1
border ×1
carousel ×1
flexslider ×1
function ×1
html ×1
hyperlink ×1
javascript ×1
padding ×1
positioning ×1
variables ×1