Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Position Images/Background Images Relative to Mouse

I would like to know what an efficient way is to animate positions of images (or background images) in relation to the mouse. Take Github, for example:

https://github.com/thispagedoesntexist

This is one hella sexy 404 page.

I want to make an impact on my users, and this surely does so in my opinion.

Questions

1) How can this be done?

2) Just CSS? CSS & JS?

3) Lastly, any libraries for stuff like this?

like image 796
karns Avatar asked May 22 '15 00:05

karns


People also ask

How the position of a background image is set in a Web page?

The background-position property sets the starting position of a background image. Tip: By default, a background-image is placed at the top-left corner of an element, and repeated both vertically and horizontally.

Which property specifies where the background images position?

The background-position CSS property sets the initial position for each background image. The position is relative to the position layer set by background-origin .

How many ways background picture can be positioned?

You can give background-position up to four values in modern browsers: If you declare one value, that value is the horizontal offset. The browser sets the vertical offset to center . When you declare two values, the first value is the horizontal offset and the second value is the vertical offset.

What is the syntax for setting background image position?

Syntax: background-position: value; Note: The background-image is placed default to the top-left corner of an element with a repetition on both horizontally & vertically.


1 Answers

This was made with a jQuery plugin called Plax.

like image 196
Chris Jenkins Avatar answered Oct 20 '22 23:10

Chris Jenkins