小编Joh*_*ohn的帖子

jQuery滚动到锚点(减去设定的像素数量)

我使用以下代码使用jQuery滚动到锚点:

$(document).ready(function() {
  function filterPath(string) {
  return string
    .replace(/^\//,'')
    .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
    .replace(/\/$/,'');
  }
  var locationPath = filterPath(location.pathname);
  var scrollElem = scrollableElement('html', 'body');

  $('a[href*=#]').each(function() {
    var thisPath = filterPath(this.pathname) || locationPath;
    if (  locationPath == thisPath
    && (location.hostname == this.hostname || !this.hostname)
    && this.hash.replace(/#/,'') ) {
      var $target = $(this.hash), target = this.hash;
      if (target) {
        var targetOffset = $target.offset().top;
        $(this).click(function(event) {
          event.preventDefault();
          $(scrollElem).animate({scrollTop: targetOffset}, 400, function() {
            location.hash = target;
          });
        });
      }
    }
  });

  // use the first element that …
Run Code Online (Sandbox Code Playgroud)

anchor jquery scroll

33
推荐指数
4
解决办法
8万
查看次数

WordPress - 如何删除元生成器标签?

我有这些标签:

<meta name="generator" content="Woo Framework Version 3.1.1" />
<meta name="generator" content="WordPress 3.5" />
<meta name="generator" content="Canvas 3.0" />
Run Code Online (Sandbox Code Playgroud)

我理解删除我添加的WordPress版本标记:

remove_action( 'wp_head', 'wp_generator' ); // goes into functions.php
Run Code Online (Sandbox Code Playgroud)

但是如何删除主题meta标签?

wordpress meta-tags

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

iPad/ios6没有渲染png背景图片

在ios5上,网站加载正常并且看起来正确.

由于ios6我的网站中使用png图像作为其背景的一部分开始在iPad上呈现,但是背景只是变为黑色而没有明显的原因(注意所有其他部分保持正确的颜色).

码:

<section id="showcase">
    <section class="container">
    <img src="images/usp.jpg" alt="USP Screen" id="screen">

    <h2>title</h2>    

    <p>the text.</p>

    <p>The text.</p>
    </section></section>
Run Code Online (Sandbox Code Playgroud)

CSS:

#showcase           { background: url(../images/showcasebg.png) repeat-x #ededed; height: 600px; position: relative; top: 87px; }
#showcase h2        { float: left; max-width: 422px; font-family: 'Lobster', cursive; font-size: 36px; margin-top: 20px; }
#showcase p         { float: left; max-width: 422px; margin-top: 20px; }
Run Code Online (Sandbox Code Playgroud)

html css png ipad ios6

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

@media查询 - 一条规则会覆盖另一条规则吗?

我有多个@media查询都工作正常,但是当我放入比1024px更高的最大屏幕宽度时,更高宽度的规则将应用于所有内容.

    @media screen and (max-width: 1400px)
    {
        #wrap {
        width: 72%;
        }
    } 
@media screen and (max-width: 1024px) 
{
    #slider h2 {
    width: 100%;
    }
    #slider img {
    margin: 60px 0.83333333333333% 0 2.08333333333333%;
    }
    .recent {
    width: 45.82%;
    margin: 10px 2.08333333333334% 0 1.875%;
    }
}
Run Code Online (Sandbox Code Playgroud)

正如你可以看到1024px(以及800px最大宽度查询)不改变#wrap宽度并正常工作.一旦我添加了1400px的最大宽度查询,它就会将它们更改为所有尺寸的72%,并对任何元素执行相同的操作 - 例如,如果我将#slider img设置为具有40px的边距,它将显示所有尺寸,即使它只在最大宽度1400px.

我错过了一些非常明显的东西吗 过去两天一直试图解决这个问题!谢谢,约翰

css css3 media-queries responsive-design

5
推荐指数
1
解决办法
7981
查看次数

没有属性"data-cfasync"(Olark)WP

自从添加代码以使用Olark:http://www.olark.com/

我得到验证错误

<script data-cfasync="false" type='text/javascript'>/*<![CDATA[*/window.olark||…
?
You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using …
Run Code Online (Sandbox Code Playgroud)

validation wordpress plugins widget

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

使用jQuery一个接一个地切换DOM元素

我有以下代码:

<div id="quotes">
    <p>"Quote 1."</p>
    <p>"Quote2!"</p>
    <p>"Quote3"</p>
    <p>"Etc"</p>
</div>
Run Code Online (Sandbox Code Playgroud)

有没有一种简单的方法来循环每个报价,所以显示报价1然后淡出显示quote2!等或我需要使用插件吗?

javascript jquery jquery-animate

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