ABigImage

ABigImage is jQuery plugin for viewing big versions of images.

Current version: 1.2.6 (2014-07-23).

Features

Example

First image Second image Third image Fourth image

Live example, where I'm using and testing this plugin at the moment: kawaiinyan.com.

Usage

Basic

Add jQuery and ABigImage scripts in head of page.

<script src="jquery.js"></script>
<script src="abigimage.jquery.js"></script>

Call plugin on selector of enlargeable images links.

$(function() {
    /* all links with class "myimgclass" */
    $('.myimgclass').abigimage();

    /* or all links to "*.jpg" images */
    $('a[href$=".jpg"]').abigimage();

    /* or all links to images under dir "/my/images/dir/" */
    $('a[href^="/my/images/dir/"]').abigimage();
});

Options

Plugin generates next html code:

<!-- overlay -->
<div></div>
<!-- layout -->
<div>
    <!-- box -->
    <div>
        <!-- prevBtnWrapper (clickable behind the image, width 50%) -->
        <div>
            <!-- prevBtnBox (clickable above the image, button width) -->
            <div>
                <!-- prevBtn -->
                <div><!-- prevBtnHtml --></div>
            </div>
        </div>
        <!-- closeBtnWrapper (clickable behind the image, width 50%) -->
        <div>
            <!-- closeBtnBox (clickable above the image, button width) -->
            <div>
                <!-- closeBtn -->
                <div><!-- closeBtnHtml --></div>
            </div>
        </div>
        <!-- img -->
        <img>
        <!-- imgNext -->
        <img>
        <!-- imgPrev -->
        <img>
    </div>
    <!-- bottom -->
    <div></div>
</div>

Using onopen handler

Function, defined as onopen handler, executes in context of plugin, and receives target element as argument. Plugin elements available in this context as properties.

$(function() {
    $('a[href$=".jpg"]').abigimage({
        bottomCSS: {
            fontSize: '2em'
        },
        onopen: function (target) {
            this.bottom.html(
                $('img', target).attr('alt')
            );
        }
    });
});

Using data-href attribute

If you want different link for plugin's big image and for non-javascript clients (search engines or browsers without javascript) - use data-href attribute:

<a href="/non_javascript_link.html" data-href="/images/big/myimage.jpg"> ... </a>

Also, you can use data-href attribute on any element, not only links.

Static methods

/* open image by URL */
$.abigimage.open('/some_image.jpg');

/* open image by index in current list */
$.abigimage.open(5);

/* open image by URL at specified position in current list */
$.abigimage.open('/some_image.jpg', 5);

/* open next image */
$.abigimage.next();

/* open previous image */
$.abigimage.prev();

/* close image */
$.abigimage.close();

P. S.

I WANT your comments, feature requests, bug reports, suggestions, thoughts... on GitHub.