ColorBox is a light-weight, customizable lightbox plugin for jQuery 1.3, 1.4, and 1.5.
This extension sets up the necessary javascript codes to display content with ColorBox jQuery plugin.
This was built with Yii 1.1.7. but should work with all versions from 1.0
Copy the unzipped contents of the extension into your application's protected/extensions folder.
//Create an instance of ColorBox $colorbox = $this->widget('application.extensions.colorpowered.JColorBox'); //Call addInstance (chainable) from the widget generated. $colorbox ->addInstance('.colorbox', array('maxHeight'=>'80%', 'maxWidth'=>'90%')) ->addInstance('.colorbox1', array('iframe'=>true, 'width'=>'80%', 'height'=>'80%')) ->addInstance("a[rel='example1']");
<a href="myimage.jpg" class="colorbox"><img src="myimage.jpg" alt="" /></a> <a href="http://www.google.com" class="colorbox1">Open Google</a> <a href="slide1.jpg" rel="example1" title="Slide Number One"> <img src="thumb1.jpg" alt="" /> </a> <a href="slide2.jpg" rel="example1" title="Slide Number Two"> <img src="thumb2.jpg" alt="" /> </a> <a href="slide3.jpg" rel="example1" title="Slide Number Three"> <img src="thumb3.jpg" alt="" /> </a>
You can also customize ColorBox's appearance by specifying cssFile in the widget options
//Create an instance of ColorBox with cuztomized appearance $colorbox = $this->widget('application.extensions.colorpowered.JColorBox', array('cssFile'=>'/path/to/css'));
Total 8 comments
Did you use 'afterAjaxUpdate' method of CListView, we need to reassign the colorbox event after ajax update (i.e. Sort or Paginate).
Add following property to CListView:
Add following JS to your view:
There is a problem with ClistView & jcolorbox. When i'm using sorting in ClistView - jcolorbox stops working. How can i fix this bug?
image reading from controller, can only be displayed in tag, so thumbnails are working fine but since the main image is part of href, image is loading as binary data. any idea how to do it ?
The colorbox works perfectly fine to show the grid within itself but when we sort the grid which triggers an ajax call to load it again, the page is completely posts back and grid does not being refreshed within colorbox. Here is the link for for more details.
UPDATE:
Fixed (Solution):
This is achieved by setting iframe property of colorbox to true. Following is the code:
please change line 23:
to:
and line 35 to:
so that you can put your own css file under e.g. "css" in "htdocs"
colorbox is good, thx.
I'm sorry! Cool worjing!
Leave a comment
Please login to leave your comment.