rss
twitter
    Find out what I'm doing, Follow Me :)

Image Rotation with Jquery Plugin

It is a great plugin for rotation of images with the help of Jquery.

This plugin is a copy of mooTools implementation made by Cédric for this library, check it out at http://www.piksite.com/mRotate/ (IT might be outdated!)

Download:

jQueryRotate.js

Description:


This is an final product of a Wilq32.PhotoEffect Snippet. Actually you can use this simple and tiny script to get effect of rotated images directly from client side (for ex. user generated content), and animate them using own functions.


Usage:

jQuery(imgElement).rotate(angleValue)

jQuery(imgElement).rotate(parameters)

jQuery(imgElement).rotateAnimation(parameters)

jQuery(imgElement).rotateAnimation(parameters)


Returns:


jQueryRotateElement - !!! NOTICE !!! function return rotateElement instance to help connect events with actually created 'rotation' element.


Parameters:

  • ({angle:angleValue,


  • [animateAngle:animateAngleValue],


  • [maxAngle:maxAngleValue],


  • [minAngle:minAngleValue],


  • [callback:callbackFunction],


    • [bind:[{event: function},{event:function} ] })

jQuery(imgElement).rotateAnimation


Where:

  • - angleValue - clockwise rotation given in degrees,

  • - [animateAngleValue] - optional parameter, animate rotating into this value,

  • - [maxAngleValue] - optional parameter, maximum angle possible for animation,

  • - [minAngleValue] - optional parameter, minimum angle possible for animation,

  • - [callbackFunction] - optional function to run after animation complete,

  • - [bind: [ {event: function}...] -optional parameter, list of events binded to newly created rotateable object
Examples:

$(document).ready(function()
{
$('#image').rotate(-25);


});


vikas nandal


$(document).ready(function()
{
$('#image2').rotate({angle:5});
});





$(document).ready(function()
{
var rot=$('#image3').rotate({maxAngle:50,minAngle:-55,
bind:
[
{"mouseover":function(){rot[0].rotateAnimation(50);}},
{"mouseout":function(){rot[0].rotateAnimation(-50);}}
]
});
});

Ajax pagination with mislav's will_paginate

Installation of mislav's will_paginate.

In previous rails versions the PaginationHelper was in bilt but in later versions (Rails 2.0) it is deleted. There are two ways to install the will paginate.
  • use the gem(recommended)
  • install as Rails plugin using git

I have put that in the vender/gems folder.
Here is the process :

Gem Installation.

  1. Download the gem from the Git Hub :
  2. git clone git://github.com/mislav/will_paginate.git

  3. Put this in vender/gems folder.

  4. Put the following code in environment.rb file :

  5. config.gem "mislav-will_paginate", :version => "2.3.6", :lib => "will_paginate"
  6. Now in your controller write the code for pagination :


  7. def index
    @posts = Post.paginate(:all, :page => params[:page], :per_page => 6)
    respond_to do |format|
    format.html { }
    format.js {
    render :update do |page|
    page.replace_html 'all-posts', :partial => @posts
    page.replace_html 'pagination', :partial => 'pagination',
    :locals => {:collection => @posts}
    end
    }
    format.xml { render :xml => @posts }
    end
    end



    There will be two partials one for showing the posts and other for the pagination helper.

  8. The pagination partial will look like this : -
  9. pagination.html.erb :-

    <%= will_paginate collection, :remote => "true", :params => { :paginated => true } %>



  10. The index.rhtml file will be :


  11. index.html.erb :-



    <%= render :partial => @posts %>