Member
Member
vincent3569   2011-03-05, 17:30
#1

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.

Member
Member
binoyte   2012-09-26, 15:44
#2

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

Member
Member
vincent3569   2012-09-26, 21:18
#3

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; });

//]]>

`

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.