小编SMa*_*yen的帖子

将SVG从灰度转换为css3过渡动画

我正在尝试使用下面概述的技术将元素从灰度转换为颜色:

CSS

  .technical .tech-icon {
      width: 33px;
      height: 32px;
      display: inline-block;
      filter: url(filters.svg#grayscale); /* Firefox 3.5+ */
      filter: gray; /* IE6-9 */
      -webkit-filter: grayscale(1); /* Google Chrome & Safari 6+ */

      -webkit-transition: all 0.5s ease-out;  /* Safari 3.2+, Chrome */
         -moz-transition: all 0.5s ease-out;  /* Firefox 4-15 */
           -o-transition: all 0.5s ease-out;  /* Opera 10.5–12.00 */
              transition: all 0.5s ease-out;  /* Firefox 16+, Opera 12.50+ */
      }
Run Code Online (Sandbox Code Playgroud)

对于firefox,我们有filters.svg

<svg xmlns="http://www.w3.org/2000/svg">
 <filter id="grayscale">
  <feColorMatrix type="matrix" values="0.3333 0.3333 0.3333 0 0 0.3333 …
Run Code Online (Sandbox Code Playgroud)

css svg css3

8
推荐指数
1
解决办法
4684
查看次数

如何更改<li>项目的每个项目符号点的颜色?

比方说,例如,我想要一个项目列表,每个项目的每个项目都有不同的颜色项目符号点.

踢球者是我需要相对语义和自动地做到这一点,避免用户必须添加一个类或一段HTML,同时保持文本的颜色为黑色.

一个例子:

  • 列出具有红色子弹的项目
  • 列出具有蓝色子弹的项目
  • 列出带有绿色子弹的项目
  • 等等

它提出了一个有趣的问题 - 如何做到这一点,以便用户可以简单地添加项目列表,我的代码相应地更新它们.

html css jquery

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

从变量中删除字符

我在变量中有以下内容, |MyString|

我想剥离领先|和结束|回归MyString

这样做最快,最不强烈的方法是什么?

php

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

我可以改进这个jQuery代码重复吗?

我想学习jQuery的最佳实践,以及如何避免代码重复和使用优雅的代码.

我写过:

<script type="text/javascript">
  // Change the category name with the filter
  $(function() {

    // Featured
    $('.featured').click(function() {
      $('.categoryTitle h1').hide().html('Featured').fadeIn('slow');
    });
    // Web
    $('.web').click(function() {
      $('.categoryTitle h1').hide().html('Web').fadeIn('slow');
    });
    // Brand
    $('.brand').click(function() {
      $('.categoryTitle h1').hide().html('Brand').fadeIn('slow');
    });
    // Print
    $('.print').click(function() {
      $('.categoryTitle h1').hide().html('Print').fadeIn('slow');
    });
    // All
    $('.all').click(function() {
      $('.categoryTitle h1').hide().html('All').fadeIn('slow');
    });
  });
</script>
Run Code Online (Sandbox Code Playgroud)

HTML

<ul id="filters">
    <li><a class="featured" href="#" data-filter=".feature-this">Featured</a></li>
    <li><a class="web" href="#" data-filter=".category-web">Web</a></li>
    <li><a class="brand" href="#" data-filter=".category-brand">Brand</a></li>
    <li><a class="print" href="#" data-filter=".category-print">Print</a></li>
    <li><a class="all" href="#" data-filter="*">Show All</a></li>
</ul>

<div class="categoryTitle"> <h1>Featured</h1> </div> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

带有倾斜右下角的CSS按钮

我试图在右下角创建一个带透明蒙版的矩形按钮,按照这个小提琴:

http://jsfiddle.net/c6gUX/

body {
background: #fff;
padding: 5em;
}
.button {
    color: #FFFFFF;
    font-family: 'RalewayRegular', Arial,sans-serif;
    font-size: 1em;
    padding: 0.5em 1.2em 0.5em 0.8em;
    position: relative;
    text-decoration: none;
}
.button:hover {
    background: linear-gradient(to bottom, #FFA13E 0px, #E56204 100%) repeat scroll 0 0 transparent;
    color: #FFFFFF;
}
.button:after {
    background: url(http://i.imgur.com/8Vvw1Sw.png) no-repeat scroll 0 0 transparent;
    bottom: -12px;
    content: " ";
    height: 38px;
    position: absolute;
    right: -12px;
    width: 36px;
    z-index: 99;
}
.orange-grad {
    background: #ffa13e; /* Old browsers */
    /* IE9 …
Run Code Online (Sandbox Code Playgroud)

html css css3

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

获取一个href attr并将其设置为另一个

<script type="text/javascript">
$(function() {

    $('.thelink a').select(function() {

        var a_href = $(this).attr("href");

    });
    $('.calltoActionMoreInformation a').attr('href', a_href);
});
</script>

  <div class="thelink" style="height: 250px; position: relative;">
  <a title="xxx" href="xxx">
    <img alt="tree" src="x" />

  </a>
  </div>
Run Code Online (Sandbox Code Playgroud)

试图将href从内部放入:

  <span class="calltoActionMoreInformation" style="position: absolute; bottom: 0px;">
   <a title="" href="--Link here--"></a>
  </span>
Run Code Online (Sandbox Code Playgroud)

如果我设置var a_href ='http://www.google.co.uk'; 它设置正确,所以问题在于获取.thelink div中唯一链接的href.

如何将.thelink a中的href分配给.calltoActionMoreInformation

jquery

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

标签 统计

css ×3

jquery ×3

css3 ×2

html ×2

javascript ×1

php ×1

svg ×1