A product page is any page on your website that showcases a product. It has to describe its features, give some screenshots, and be descriptive. Naturally, this is the place where you build up the visitor’s interest towards your product, but it is getting increasingly difficult to be original in grabbing their attention. Luckily, a new compact JavaScript library can help you make a splash.
impress.js is a small, standalone library that makes it easy to design advanced CSS3 presentations with eye-catching effects. But what if we used impress.js for something other than a presentation? This is what we are doing today – we will be spicing up a plain old product page with some CSS3 magic!
The HTML
We start of with a simple HTML5 document that will be the backbone of today’s example.
index.html
Impressive CSS3 Product Showcase #impress .step width:700px; height: 600px; position:relative; margin:0 auto; -moz-transition:1s opacity; -webkit-transition:1s opacity; transition:1s opacity; #impress .step.active opacity:1; #impress h2 font: normal 44px/1.5 'PT Sans Narrow', sans-serif; color:#444648; position:absolute; z-index:10; #impress p font: normal 18px/1.3 'Open Sans', sans-serif; color:#27333f; position:absolute; z-index:10; #impress img position:absolute; z-index:1;
As you can see in the rules above, and in the HTML fragment in the beginning of this tutorial, the #impress container is assigned a .impress-not-supported class. The class is removed only if the current browser supports the functionality required for the library to run successfully.
Now we need to style the individual slides. I will only include the classes for the first slide here, you can find the rest in assets/css/styles.css.
/*---------------------------- Slide 1 - Intro -----------------------------*/ #impress #intro width: 500px; #intro h2 text-align: center; width: 100%; #intro p font-size: 22px; left: 290px; line-height: 1.6; top: 220px; white-space: nowrap; #intro img top: 120px;
All that is left is for a quick JS snippet to initiate impress.js, and listen for clicks on the arrows.
jQuery
To initialize the impress library we need to call the method of the same name. This will also return a new object, with methods for showing the previous / next slides.
script.js
$(function() var imp = impress(); $('#arrowLeft').click(function(e) imp.prev(); e.preventDefault(); ); $('#arrowRight').click(function(e) imp.next(); e.preventDefault(); ); });
With this our impress-ive product showcase is complete!
Done!
You can use this example for product and landing pages, feature showcases and with some randomization you could even turn it into an image gallery.
|
Impress.js is a small, standalone library that makes it easy to design advanced CSS3 presentations with eye-catching effects. But what if we used impress.js for something other than a presentation?}
Read more : Making an Impressive Product Showcase with CSS3
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.