小编Pic*_*ard的帖子

滚动后更改CSS

我有一个导航栏,它使用一些 CSS 来更改不透明度:

\n
.navbar {\n    background-color: #4B5253;\n    opacity: 0.8;\n    filter: alpha(opacity = 80);\n}\n
Run Code Online (Sandbox Code Playgroud)\n

我需要在用户向下滚动一定数量的像素后opacity更改为,例如。1.0500px

\n

我正在使用 jQuery,但我没有找到解决方案。

\n

另外,我不擅长 JavaScript,有时我不知道应该把代码放在哪里。因此,如果有什么方法可以用 CSS 来完成这一切,那就太棒了!

\n

这是我想要的示例\xe2\x80\x94向下滚动时密切注意标题。

\n

javascript css scroll

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

如何使用 PHPUnit 在 Laravel 上测试更复杂的情况

我在我的项目中使用 Laravel,并且我是单元/功能测试的新手,所以我想知道在编写测试时处理更复杂的功能案例的最佳方法是什么?

我们来看这个测试示例:

  // tests/Feature/UserConnectionsTest.php
  public function testSucceedIfConnectAuthorised()
  {
    $connection = factory(Connection::class)->make([
      'sender_id'     => 1,
      'receiver_id'   => 2,
      'accepted'      => false,
      'connection_id' => 5,
    ]);

    $user = factory(User::class)->make([
      'id' => 1,
    ]);

    $response = $this->actingAs($user)->post(
      '/app/connection-request/accept',
      [
        'accept'     => true,
        'request_id' => $connection->id,
      ]
    );

    $response->assertLocation('/')->assertStatus(200);
  }
Run Code Online (Sandbox Code Playgroud)

所以我们遇到了这样的情况,两个用户之间有一些连接系统。数据库中有一个Connection由其中一位用户创建的条目。现在要使其成功连接,第二个用户必须批准它。问题在于UserController通过以下方式接受这一点connectionRequest

  // app/Http/Controllers/Frontend/UserController.php
  public function connectionRequest(Request $request)
  {
    // we check if the user isn't trying to accept the connection
    // that he initiated himself
    $connection = …
Run Code Online (Sandbox Code Playgroud)

testing phpunit laravel laravel-5

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

标签 统计

css ×1

javascript ×1

laravel ×1

laravel-5 ×1

phpunit ×1

scroll ×1

testing ×1