Most of you have heard of Jquery Colorbox Plugin. Colorbox is a light-weight, customizable lightbox plugin for jQuery 1.3 through 1.6. In Drupal 7 colorbox jquery plugin is integrated with a module Colorbox.
! M, g9 k- N- {! V0 e2 O' {! M8 I$ K9 {7 R/ C
Images, iframed or inline content etc. can be displayed in a overlay above the current page.1 l5 Z! o2 O- P# V7 H& X
+ U& r6 l: \& T* u* M
5 g# a' P& f6 v8 n5 Z
% F) Q/ y$ p4 j. o* [$ e' | l4 U6 a; Q3 V& ]! Q
- z* S$ n! j! s$ J0 Z# {1 D
6 B& ]# V- V& n4 s; o9 M8 s; Q( l% A* C! N
Features
7 u. D3 K3 L* Z$ a* _% p2 i6 YThe Colorbox module:4 }/ Q/ b+ Z0 E! ?5 o# P
$ d* P+ e, w& u9 R0 A
Excellent integration with Imagefield, Imagecache,Insert and Image modules* `) ?& m1 }, n% m' H' x! R
Choose between a default style and a number of other styles that are included.
# ^ M y& F8 k; `Style the Colorbox with a custom Colorbox style in your theme.# u( J; |$ p3 f. ?( Y/ A+ b: o1 f
Option to open a login form by clicking on any login link8 b: G8 `6 U6 ~# X6 s# t( a( ~/ z
Drush command to download and install the Colorbox plugin in sites/all/libraries as well as a Drush make file
~) B/ u& y* OThe Colorbox plugin:, U* @ u* d& _4 L' a- n3 ^. W1 ~
, A. Y* f- m5 B9 z
Supports images, image groups, slideshow, ajax, inline, and iframed content.
1 _0 w, T1 o# E+ ?7 `+ t( P! y0 aAppearance is controlled through CSS so users can restyle the box.
$ D) q/ J* f' q- ]! o, UPreloads background images and can preload upcoming images in a photo group.8 p% D7 [' J2 A$ [! G7 E
Now lets use the colorbox module to show content images in a colorbox.; J; A U- w9 Y, X
* S6 N. K0 Q; U m- y+ v
Download the Colorbox module from drupal.org and place it in sites/all/modules folder.
: @9 M- k0 P- ] g5 _
5 K7 o1 n+ [7 c& o1 [0 kGo to Modules and enable the Colorbox module.. Q1 A# _6 \7 }/ A3 v7 f% F
7 ^8 m) i- L! P# i& q( i4 EDownload and unpack the Colorbox plugin in “sites/all/libraries”.
b4 V8 ^* U' U! S, P5 lLink: http://colorpowered.com/colorbox/colorbox.zip
; o' K( _ Y& o9 Y- uDrush users can use the command “drush colorbox-plugin”.
7 w& K, o9 p; g9 f) t
. F) _+ ]' Z4 L" M7 ]8 l( n) SAdd two new presets by clicking on configuration-> Media ->Image Styles.8 y4 P" f+ A2 K. @
5 T2 F* Q2 E0 `' U
Set the height and width of the presets accoiridng to your requirements.' g& s0 _4 ]$ p: b: i2 Y4 X0 s
/ [2 B) H; x2 Z. nOne preset will used for the preview image and the other one we use for the full image to be shown on colorbox.
- H: Z1 o# }! ]7 Y2 M X# Y' _% {" E" u ~
Save both the image styles.9 t3 P0 _5 h0 M. ]- x. E8 P9 Q; k; A$ x
n8 t& p/ X) e& K# G: {1 {
Create a new content type.6 \0 D- u( S: K
& ?' x" q/ ?1 `- U- ^- A7 d, \
Add a image field to it.4 K7 W9 ^& S ]8 N% h @8 ]
7 g, n* V1 M8 ]2 J7 V( Z% R% t
Select the image preview style name we just created in the image styles. Here we will use the smaller image. to be shown on the listing page. Click save." G& L, R2 T& R& f# _6 |2 Z
) {9 S. q1 K. r/ q0 f3 r* ZAdd some images to the new content type we just created.
# B' o6 Y3 ^/ J/ g! M& b
/ ~9 q+ ]3 g3 ~$ D/ S, kCreate a view give it a name and continue with the default settings.
! b7 l6 o! _$ J* w% E+ C5 `0 ?$ r% N7 f5 ^
9 p& Y! p" k6 k+ Q7 H& x( P) r; @$ R
Apply the filter criteria by choosing the content name as the filter.3 V, g/ _( H* f5 t" J3 J+ d; z
4 x2 g- `9 d* P
Now select fields to display in the view.4 T5 ^2 f7 ~9 n) @% Q
. R$ c8 i% h! x* H/ j2 N. gSelect Content Title and Content : Image Field Name as the fields.1 X. F8 \4 s. [2 n3 [* `
" }1 w2 s* n4 KIn the Image Field Name settings page enter a label name for the field.
5 f( {- i$ F& h7 P4 {
% x6 B, q6 A8 D/ d2 L3 ]& WIn the Formatter dropdown select the Colorbox option.
9 g8 i: }* r/ ]# q1 z4 D' j6 e$ v) J! F9 v6 P$ f g$ g
In the Node Image Style choose the name of the image style we created. Remember to use the smaller size for this field.0 o/ x0 @) b+ u1 k
" P/ G4 @( b1 t- b& `; _8 NIn the Colorbox Image Style select the name of bigger image style.+ r$ L9 g) r/ k+ M
, S! P* K2 G0 U) W& f; e; [Click save and save the views also.
7 Z" ]/ g, Z% {5 c, v( O. z7 x& h" g* }6 @
Now go back to the content type we have just created.
: P& j4 g8 F9 O& l+ L( P- jClick on Manage Display Field." n( r1 C. N4 A
) m' f" l: o3 ~
Next to Image field is a dropdown labelled as Format.9 b( i1 G0 q3 j Z I! j
0 h; i7 o- {# ^4 a. C3 cSelect Colorbox and configure the settings for the field.
+ x- ]& r8 R; o
# W9 g% P! x2 d1 |$ aNode Image Style : Smaller Image style.7 I; b" }# f6 B# D) ]6 W- M
3 [0 I. p% W5 W9 u' _! }+ x
Colorbox Image Stye : Large Image Style.9 J; v9 m4 {3 k2 w' O( f
~" v: Y5 z) L# E- t
Click Save.: B3 V. w/ o1 t
7 T: d" n6 |; J' O8 xNow you can see your images in a colorbox by clicking on them.% w% X9 A. x6 E: X% t
* i! l& s+ e* s MYou can also use the Colorbox Stylesheets. Just copy the whole folder into your theme folder include in into your template files.) k* c( L7 ~3 _0 X# n. c' I
+ f) G& [, _/ `: v( f
With Colorbox plugin we can do lots of stuff with the images. This is the basic one to begin with. In the next post I will try to bring some advance usage with the Colorbox Plugin.+ P1 ]- h" q( y' J$ m: |3 `
( t: f) A4 u1 B0 }7 ~8 T
5 S L- p, C5 A2 O+ L) b2 e7 P6 i- g3 ~0 ] i
% t8 @ q3 Q7 r, c8 F
/ N& X! i: Q+ Q! Q
|
|