ZenphotoCMS Forum
conflit between colorbox and navigation script - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: conflit between colorbox and navigation script (/thread-8337.html)



conflit between colorbox and navigation script - vincent3569 - 2011-03-05

hello

with my zpArdoise theme, I have a conflit between the javascript of colorbox plugin and my personnal javascript for navigation with keyboard.

both scripts try to examine key events, but mine is used first and I want that colorbox script to be used first.

Do you have an idea to fix this issue ?

Maybe, is a variable who said that colorbox is used ?
I could use this variable to disable my javascript...

Thanks for you help.




conflit between colorbox and navigation script - binoyte - 2012-09-26

I'm also interested in a solution to that «issue».




conflit between colorbox and navigation script - vincent3569 - 2012-09-26

hi binoyte

you can download my themes zpArdoise and i-feel-dirty which solve the problem.

with i-feel-dirty, have a look on inc_header.php, lines 58 to 104, which allow keyboard navigation on image and news with, without conflict with colorbox :

`

//



        var nextURL = "";

        var prevURL = "";





            var nextURL = "";

            var prevURL = "";





    var ColorboxActive = false;             // cohabitation entre script de navigation et colorbox

    function keyboardNavigation(e) {

        if (ColorboxActive) return true;    // cohabitation entre script de navigation et colorbox

        if (!e) e = window.event;

        if (e.altKey) return true;

        var target = e.target || e.srcElement;

        if (target && target.type) return true;     //an input editable element

        var keyCode = e.keyCode || e.which;

        var docElem = document.documentElement;

        switch(keyCode) {

            case 63235: case 39:

                if (e.ctrlKey || (docElem.scrollLeft == docElem.scrollWidth-docElem.clientWidth)) {

                    window.location.href = nextURL; return false; }

                break;

            case 63234: case 37:

                if (e.ctrlKey || (docElem.scrollLeft == 0)) {

                    window.location.href = prevURL; return false; }

                break;

        }

        return true;

    }

    document.onkeydown = keyboardNavigation;

    // cohabitation entre script de navigation et colorbox

    $(document).bind('cbox_open', function() {ColorboxActive = true; })

    $(document).bind('cbox_closed', function() {ColorboxActive = false; });

//]]>

`