WordPress.org

Forums

automatic adding wp-highslide to image links (1 post)

  1. diovani
    Member
    Posted 7 years ago #

    if you dont want to add the <highslide></highslide> tag on each image when posting, just add these lines on the JavaScript Settings, on the wp-highslide options:
    Add under the 'hs.preloadImages();' method, inside the 'window.onload = function() {' function:

    var elements = $A(document.getElementsByTagName('a'));
    elements.each
    (
        function(element)
        {
            if(element.href.endsWith('jpg') || element.href.endsWith('png') || element.href.endsWith('gif'))
            {
                element.className = 'highslide';
    
                Event.observe
                (
                    element,
                    'click',
                    function(event)
                    {
                        Event.stop(event);
                        var element = Event.element(event);
                        return hs.expand(this);
                    }
                );
            }
        }
    )

    You need prototype loaded for this to work, so be sure to load it before (you can add the js link on the top of the wp-highslide settings).
    With this script all image links on your blog will use the highslide thumbnail viewer.
    I posted a portuguese tutorial here.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.