If you've seen any of my previous books, then you will see I have a thing about flowers, and in particular orchids; indeed, the cover on my first book was that of a phalaenopsis, or moth orchid! We'll use a couple of images of orchids as the basis for our next demo, as shown in the screenshot over the page, where it shows our desired effect in motion for the top image.
For this demo, we will need a copy of the tutorial1A folder from the code download that accompanies this book; make sure you dig that out before continuing:
style.scss from the src folder within tutorial1A; let's take a look at its contents.$fullsize variable to 100%:
The sharp-eyed among you will spot that not all colors have been given a value; the reason for this will become clearer later in this chapter.
16px as the base equivalent for 1rem unit:
style.scss file from the tutorial1A folder into the src folder in our project area.img folder and the index.html file—go ahead and copy both across to the root of our project area.gulp
dest folder in our project area—copy the maps folder and style.min.css into the css folder of tutorial1A.
Interesting effect, huh? It's a simple animation that uses scale() to shrink the image to 0.5 (or 50%) of its size and slides it to the right, before sliding in the infobox immediately behind it. Take the mouse off the image and the reverse happens—it's the sample principle for the second image—but in reverse; the code sets an ltr and rtl class to determine which direction the image should move in the demo.
A copy of this demo using the equivalent code from the Less CSS pre-processor is available in the code download that accompanies this book. It's in the Tutorial1B folder if your preference is to use the Less CSS pre-processor; you will need to install the gulp-less plugin from https://github.com/plus3network/gulp-less, using NodeJS (in the same manner as other plugins that we've installed). An updated copy of the Gulp task file is also included in this folder, along with completed versions of the CSS code.