A simple mouse hover position detection effect that controls horizontal image movement.

Add-ons
2026-08-03 13:01 3 次浏览 • 0 次下载 37.3KB
A simple mouse hover position detection effect that controls horizontal image movement.

Usage

Reference

1
2
<link rel="stylesheet" href="css/bgMove.css">
<script src="js/bgMove.js"></script>

CSS

1
2
3
4
#move {
background: url(images/bg1.jpg);
}
// Sets the background image

html

1
2
3
4
<div id="move">
<div id="moveL"></div>
<div id="moveR"></div>
</div>

Initialization

1
2
3
4
5
6
<script>
bgMove({
jump : 15, // Movement speed. Optional; can be omitted. Defaults to 10.
bgImgurl : "images/bg1.jpg" // Background image path in the HTML, which is required.
})
</script>

note:

  • moveL and moveR are positioned with z-index set to 1. If there are clickable elements on the page, their z-index must be greater than 1.

  • The background image must be wider than the screen for the effect to work properly.

星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare