“The moving image in the background of the Diva website works so successfully because the user isn’t accustomed to the background changing too much. In order to improve user experience think about how visitors interact with your site and what might be altered to give your users a more memorable experience – this is certain to drive traffic.”
Inspiration: www.divabymakole.at
There are so many examples of websites out there that have a good design, but not always a boundary-pushing user experience.
Occasionally, though, you will come across a website that offers a real wow factor as you explore it, providing some form of graphical awesomeness out of the blue.
When good design and interactivity are brought together you get a very memorable site. The Diva website has an incredibly simple design on first impressions. There’s a model in the background and the content is deliberately placed towards the bottom of the screen inviting you to scroll. As the user moves down the page, however, the background image comes alive as a sequence of images reveals the model getting dressed, with the content sliding over the top. All in all, it makes for a fun and unexpected experience.
#1 - INSPIRATION: Simplicity Is Key
So often a website will try and cram far too much detail in, with sidebars and content all over the place. The Diva website keeps its content relatively simple, in a single column for the majority of the page. This enhances the background image content and makes it easy to scale for smaller devices. The design has suitably been thought through when moving to tablet-style displays, as the menu moves from the side to the top. Again, when moving to a smaller phone-sized display, the background image becomes fixed saving the browser the extra workload of dealing with those images.
#2 - TECHNIQUE: Scroll-Driven Animated Images
STEP 1: Start The Document
Open a new HTML document and add the code below into the head section. This links up to the jQuery library and establishes the main structure of the page.
CODE:
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<style type="text/css">
body{
margin: 0;
height: 1800px;
min-height: 1800px;
padding: 0;
STEP 2: Complete The CSS
In the head continue adding the CSS as shown. This styles the image swap div area and allows it to fill the full screen. We create a fixed class that we add with jQuery then we add a class for each image. Continue adding classes for 3 and 4; these will be the same as 2 but with a higher z-index, positioning images correctly.
CODE:
imageSwap{
position: fixed;
overflow:hidden;
top: 0px;
left: 0px; width:100%;
}
#imageSwap.fixed {
position: fixed;
top:0 px;
}
.1 {
position:absolute;
z-index:1;
}
.2 {
position:absolute;
display:none;
z-index:2;
}
</style>
STEP 3: Add The Body Content
Move to the body section now. The following code adds a div tag to the document that contains a series of images. The CSS turns the visibility of all the images of except for the topmost (image 1). Using jQuery we will activate the appropriate image as the user scrolls.
CODE:
<div id="imageSwap">
<img class="1" src="1.jpg" />
<img class="2" src="2.jpg" />
<img class="3" src="3.jpg" />
<img class="4" src="4.jpg" />
STEP 4: Add the jQuery
Now, underneath the div tag in the body section, add the following code which defines a JavaScript area and records the position of the scrolling. As the user moves down the document the scroll position is saved in the yPos variable. This then changes the position variable for every 300 pixels that are scrolled.
CODE:
<script language="javascript" type="text/javascript">
var thisPos=1;
var lastPos=1;
$(document).ready(function () {
$('#imageSwap').addClass('fixed');
$(window).scroll(function() {
var yPos = $(window).scrollTop();
if (yPos <= 300){
thisPos=1
}
if (yPos > 300 && yPos < 599){
thisPos=2;
}
STEP 5: Switch The Images
To give the illusion the background is moving, the images in the div tag are switched between. This is done by fading in the new position class and fading out the old position. The last position variable is updated after every scroll so we know where the user is in the document.
CODE:
if (yPos > 600 && yPos < 899){thisPos=3;
}
if (yPos > 900 ){
thisPos=4;
}
if(thisPos != lastPos){
$('.'+thisPos).fadeIn(10);
$('.'+lastPos).fadeOut(10);
}
lastPos=thisPos;
});
});
#3 - TECHNIQUE: Create Your Own Image Sequence
In order to create an image sequence background like Diva, you will need to set up a DSLR and capture your subject. Ideally, you would do this in a studio, but a well-lit room with a decent flash can work just as well.
STEP 1: Set Up The Shot
You need a steady shot so grab a camera and you will definitely need a tripod. If you haven’t got a floor-mounted tripod then a GoPro or mini tripod will suffice. Use a plain white sheet for the background.
STEP 2: Import into Photoshop
Once you have captured your subject bring the first image into Photoshop and add a new layer. Use a Radial gradient with the foreground set to white and the background set to black, then drag from the centre out to apply a vignette. Lastly, change this layer’s blend mode to Multiply.
STEP 3: Colour Tweaks
Press Cmd/Ctrl+U to call up the Hue/Saturation panel and drag the Saturation slider down to take some colour out of the image. Save the file and drag in the other shots, using this as a template.
STEP 3: Colour Tweaks |
Scrolling Backgrounds With An Animated Twist
Reviewed by Kamal Thakur
on
Friday, September 18, 2020
Rating:
No comments: