README.md in thumbnail_hover_effect-0.1.0 vs README.md in thumbnail_hover_effect-0.1.1
- old
+ new
@@ -1,9 +1,9 @@
# ThumbnailHoverEffect
-Introduces simple image thumbnail 3D image hover effects using CSS 3D transforms.
-The idea is inspired by [this creat codedrops article] (http://tympanus.net/codrops/2012/06/18/3d-thumbnail-hover-effects/).
+Introduces simple thumbnail 3D image hover effects using CSS 3D transforms.
+The idea is inspired by [this great codedrops article] (http://tympanus.net/codrops/2012/06/18/3d-thumbnail-hover-effects/).
## Installation
Add this line to your application's Gemfile:
@@ -16,19 +16,43 @@
Or install it yourself as:
$ gem install thumbnail_hover_effect
+## Creating demonstration thumbnail hover effect
+
+In order to get known with the thumbnail hover effect options you can create a demo thumbnail hover effect following the steps below:
+
+__Creating thumbnail files__
+
+Executing the following line in your rails application console:
+
+ rails generate thumbnail demo
+
+Add the following lines in your *application.css* file:
+
+ *= require thumbnails/fontello.css
+ *= require thumbnails/demo/demo.css.sass
+
+__Rendering images with thumbnail hover effect__
+
+Create a instances of the generated thumbnail class and call their *render* functions like this:
+
+ <%= Demo.new.render({effect_number:1}) %>
+ <%= Demo.new.render({effect_number:2}) %>
+ <%= Demo.new.render({effect_number:3}) %>
+ <%= Demo.new.render({effect_number:4}) %>
+
## Usage
### Basic Usage
In order to implement the thumbnail 3D image hover effects in your rails application follow the steps below:
__Creating thumbnail files__
-Executing the following line in your rails application folder:
+Executing the following line in your rails application console:
rails generate thumbnail class_name
is generating the files below:
@@ -47,11 +71,11 @@
*= require thumbnails/fontello.css
*= require thumbnails/class_name/class_name.css.sass
__Rendering images with thumbnail hover effect__
-Create a instance from the generated thumbnail class and call its *render* function like this:
+Create a instance of the generated thumbnail class and call its *render* function like this:
ClassName.new(
{
url:image.image_url,
attributes:{likes:'12', dislikes: '2'}
@@ -66,11 +90,11 @@
### Custom Usage
####Using the right settings#####
-The gem generator is creating 3D hover effects using CSS 3D transforms. Because of this, you are not able to use the generated *CSS* files
+The gem generator is creating 3D image hover effects using CSS 3D transforms. Because of this, you are not able to use the generated *CSS* rules
for images with different width and height.
The generator uses default width and height if they are not supplied, but in most cases you will need to specify them:
rails generate thumbnail class_name -w 400 -h 500
@@ -80,11 +104,11 @@
**Note**: If you need to use the effect for images with various width and height you need to generated separated *CSS* files.
####Thumbnail Effects#####
-There are four built-in thumbnail effects. By default, the generator is generating *CSS* for all of them.
+There are four built-in thumbnail effects. By default, the generator is generating *CSS* rules for all of them.
1. How to generate *CSS* for specific thumbnail effect only?
In order to reduce the generated *CSS* rules you can render one or more specific effects like follows:
@@ -103,23 +127,23 @@
url:image.image_url,
attributes:{download_url:'download_url'}
}
).render
- If you need to specify an effect you can pass it as *render* function parameter:
+ If you need to specify an effect you can pass it as *render* function parameter:
ClassName.new(
{
url:image.image_url,
attributes:{download_url:'download_url'}
}
).render({effect_number:4})
####Thumbnail Template#####
-Creating a thumbnail *HTML* template is the key part of the thumbnail image 3D hover effect. Basically, this is the *HTML*,
-which is shown on image hover and it can be customized to meet the developer needs.
+Creating a thumbnail *HTML* template is the key part of the thumbnail image hover 3D effect. Basically, this is the *HTML*,
+which is shown on image hover event and it can be customized to meet the developer needs.
1. How to create *HTML* thumbnail template?
The template is extracted from your ruby *class_name*. In order to changed it you need to edit the *get_template*
function in tour *thumbnails/class_name.rb* file. It looks like this:
@@ -135,19 +159,18 @@
..
</div>
</div>
"
end
-
2. How to pass arguments to thumbnail template?
You are passing dynamics values to your template using the class's constructor *attributes* hash. For example:
ClassName.new(
{
- url:image.image_url,
- attributes:{likes:'12', dislikes: '2'}
+ url: image.image_url,
+ attributes: {likes:'12', dislikes: '2'}
}
).render
is replacing the *##likes##* and *##dislikes##* placeholders in your *HTML* template.