开发者

Lightbox with wordpress magic fields. Multiple size image

Can anyone help me create a lightbox with wordpress magic fields.

I need one 'Image (Upload Media)' in magic fields to create 2 images in different 开发者_如何学编程sizes.

e.g a thumbnail 100 x 100 px

and a lightbox image 600 x 400px

wrapped in the code:

<a href=“http://localhost:8888/large-image.jpg” rel="lightbox"><img src=“http://localhost:8888/thumbnail-image.jpg” alt="" /></a>

I am a bit stuck on how this could be achieved.


Try this solution.

PHP backend (http://wiki.magicfields.org/doku.php?id=front-end_functions):

echo '<a href="'.get_image('fieldName',1,1,1,NULL,"w=600&h=400&zc=c&q=90").'" rel="lightbox"><img src="'.get_image('fieldName',1,1,1,NULL,"w=100&h=100&zc=c&q=90").'" alt="" /></a>';

JS frontend (http://api.jquery.com/category/selectors/).

I suppose you use jQuery library for lightbox, so read about jQuery selectors. Your situation: Attribute Equals Selector [name="value"] Your js code must be:

$("a [rel='lightbox']").lightBox(params here)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜