相关疑难解决方法(0)

如何淡化变化的背景图像

我想在执行此代码时淡化图像:

$("#large-img").css('background-image', 'url('+$img+')');
Run Code Online (Sandbox Code Playgroud)

我试过在很多地方褪色.

谢谢

jquery background fade

46
推荐指数
4
解决办法
12万
查看次数

将鼠标悬停在列表项上时更改背景图像

正如您在屏幕截图中看到的,我有一个无序列表.现在div这个列表中有一个背景图片.我想要做的是每当我将鼠标悬停在列表项上时更改背景图像.请注意,每个项目都应将背景更改为其他图像.我该怎么做呢?我只找到了如何更改为单个而非多个图像的答案.

这是截图.

在此输入图像描述

我已经在列表的第一项上徘徊了.

div的CSS:

.body {
  display: block;
  float: left;
  background-image: url("bgdef.jpg");
  background-repeat: no-repeat;
  position: static;
  width: 100%;
  height: auto;
  margin: 0;
}

.menu {
  width: 250px;
  padding: 0;
  margin: 100px 0px 33% 75%;
  list-style-type: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.menu a:link,
a:visited,
a:hover,
a:active {
  text-decoration: none;
  bottom: auto;
  padding-bottom: auto;
  text-shadow: none;
}

.menu li {
  background-color: white;
  margin: 10px;
  padding: 3px 0 3px …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

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

可以使用jQuery的动画来移动HTML背景吗?

在我的网页上,我使用HTML选择器使用CSS设置背景图像.背景图像基本上类似于蓝图示意图背景.(即蓝色背景上的白色网格.)

CSS:

html
{
    display: block;
    position: absolute;
    background: url(../assets/background.jpg) repeat;
    color: #FFF;
    margin: 0px;
    padding: 0px;
    border: none;
}
Run Code Online (Sandbox Code Playgroud)

当最终用户点击按钮时,我希望上面提到的背景图像从屏幕向右上方向滑动,使页面看起来像是在大蓝图原理图上的不同区域.我正在使用jQuery,但我无法弄清楚如何从CSS访问背景图像.

JavaScript的:

$("#button").click(function()
{
    // Animate the webpage's background, causing it to move
    $("html /* Not sure what goes here */").animate({left: "-=10000px", top: "-=5000px"}, 1250);
});
Run Code Online (Sandbox Code Playgroud)

我尝试在主体中使用与最终用户屏幕的宽度和高度相匹配的div,但是在蓝图原理图像周围出现了一个粗的白色边框,所以我想我必须坚持通过CSS添加图像, HTML选择器.

我如何达到我想要的效果?

https://jsfiddle.net/zaevzm5p/

html javascript css jquery jquery-animate

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

标签 统计

jquery ×3

css ×2

html ×2

javascript ×2

background ×1

fade ×1

jquery-animate ×1