小编Dav*_*vin的帖子

CSS滤镜模糊:在CSS过渡期间防止模糊图像上的未定义图像边缘

可以通过添加负边距来防止图像具有未定义的模糊边缘,但是在CSS转换期间,这会失败.在添加或删除过滤器模糊类时,如何保持CSS过渡期间定义的图像边缘?

测试中:

  • Firefox 37:效果很好!
  • Chrome 42:图像和父元素符合图像的边框闪烁/模糊/未定义
  • IE9:没那么多......

看看我的例子:Codepen

HTML:

<link href='http://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Hind' rel='stylesheet' type='text/css'>
<div class="container">
  <img class="blur" src="http://budgetstockphoto.com/bamers/stock_photo_spectrum.jpg"/>
</div>
<div class="col">
<h2 class="montserrat">Hover Over Image</h2>
<hr>
  <p class="hind">Preventing an image from having undefined blurry edges can be achieved by adding negative margin, but during a CSS transition this fails.  As you can see, on-hover, the edges of the image become undefined/blurred.  How can you keep the edges of an image defined during a CSS transition …
Run Code Online (Sandbox Code Playgroud)

css jquery css3 css-transitions css-filters

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

永久设置私有类变量PHP

问题:我想在类中永久设置私有变量,然后使用类外部的getter函数访问它们.问题是每次我实例化一个新的类并创建一个对象时它会破坏先前设置的变量.在提供的示例中,我不想通过调用函数"getAgain"传递对象.我想简单地访问globalVars类而不破坏任何设置变量.我知道通过创建一个'新对象'本质上会破坏当前不是静态的变量.所以:

  • 你如何在一个类中永久设置私有变量?
  • 要么
  • 如何在不重新实例化类的情况下调用函数(getter/setter)(以免破坏当前设置的var(s)).

我担心我不会以正确的方式接近这一点,或者我的方法论存在缺陷.

<?php

class globalVars{

   private $final = "Default Foo </br>";

   public function setter($param){
      $this->final = $param;
   }

   public function getter(){
      return $this->final;
   }

}

class driver{

   function __construct($param){
        $globalVars = new globalVars();
        $globalVars->setter($param);

        $val = $globalVars->getter();
        echo $val;

        $this->getAgain();
   }

   function getAgain(){
       $globalVars = new globalVars();
       $val = $globalVars->getter();
       echo $val;
   }
}


$input = "Change to Bar </br>";

$driver = new driver($input);

?>
Run Code Online (Sandbox Code Playgroud)

php class global-variables objectinstantiation getter-setter

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