0
A
回答
0
确定了一些战略和一些例子。
策略:
- 地方背景
- 地方一些阻挡了它
- 做出
div
使用相同的背景 - 如果鼠标移动,移动这个div
- 如果
div
移动,将背景移动到主背景的负位置。
例子:
$(function(){
$(document).mousemove(function(e){
var x = e.pageX;
var y = e.pageY;
var $t=$(".transfier");
var newLeft =x-$t.width()/2;
var newTop= y-$t.height()/2;
$t.offset({
top: newTop,
left: newLeft
});
$t.css('background-position-x', 0 - x + $t.width()/2);
$t.css('background-position-y', 0 - y + $t.height()/2);
});
});
body {
background: url(https://wallpaperscraft.com/image/height_canyon_retina_81205_3840x2400.jpg);
background-position: 0px 0px;
background-repeat: no-repeat;
margin: 0px;
}
.transfier {
background: url(https://wallpaperscraft.com/image/height_canyon_retina_81205_3840x2400.jpg);
background-repeat: no-repeat;
background-position: 0px 0px;
position: absolute;
left: 0px;
top: 0px;
width: 200px;
height: 200px;
border: 2px solid green;
}
.blockMyView {
background-color: white;
width: 75%;
height: 300px;
border: 1px solid black;
margin: 50px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="transfier"> hoi </div>
<div class="blockMyView"></div>
相关问题
- 1. 如何制作JPanel透明?
- 2. 如何在C#中制作一个简单的放大镜#
- 3. 绘制透明缩放PNG
- 4. 三JS不透明镜
- 5. 制作点透明
- 6. 如何制作一段透明的
- 7. 如何制作透明布局?
- 8. 如何制作不透明的活动?
- 9. UIBarButtonItem - 如何制作半透明黑色?
- 10. 如何制作透明标题?
- 11. 如何制作半透明UITableViewCells?
- 12. 如何制作SurfaceView透明背景?
- 13. 如何制作半透明布局?
- 14. 如何制作透明渐变?
- 15. 如何制作视图50%透明?
- 16. 如何制作“鼠标透明”面板?
- 17. 如何制作一个透明的QWidget
- 18. 如何制作一个System.Drawing.Image半透明?
- 19. XNA如何制作透明纹理
- 20. 如何制作一个透明的UIWebView
- 21. 如何制作一个透明的jframe可调整大小?
- 22. Android放大镜
- 23. JavaScript放大镜
- 24. 如何绘制透明线?
- 25. 制作部分透明
- 26. 制作像素半透明
- 27. 制作透明按钮
- 28. 透过BitMap制作透明画布
- 29. MFC - 放大镜VC++
- 30. 如何为透视效果制作边框的透明边角?
你的问题不是很清楚 尝试添加一个例子 或者你做了什么,到目前为止,哪些需要固定 –
只要改变元素的透明度,当你悬停? – Ian
基本上我只想在这里看到bg-one:https://jsfiddle.net/9dqh88ff/。我认为这可以用svg过滤器来完成,但我不确定:) –