gem 'jquery-rails'
gem 'fancybox-rails'
Then run bundle install to update your application's bundle.
Now you need to edit your app/assets/javascripts/application.js file and add the following line:
//= require jquery
//= require fancybox
And then edit your app/assets/stylesheets/application.css file to look something like:
/*
*= require_self # it may be present previously , so if system crash remove it
*= require fancybox
*= require_tree .
*/
Then in the view page where you want to add fancy box design just add the following function within head in script tag
<script type = "text/javascript">
$(document).ready(function() {
/* This is basic - uses default settings */
$("a.flickr_photo").fancybox({'type': 'image'});/*a.flickr_photo is for creating flickr_photo class that too within fancybox*/
$("a.flickr_ajax").fancybox();/* in the same way , flickr_ajax is another class , */
/*we ll create different class and ll reference to those class where we want
});
</script>
then in the link add some code
<a class='flickr_photo' href="/assets/product/<%=prod.image%>">
we add the above line before image tag
No comments:
Post a Comment