![]() |
|
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 : ` <?php if (($_zp_gallery_page == 'image.php') || ((function_exists('is_NewsArticle')) && (is_NewsArticle()))) { ?> <script type="text/javascript"> //<![CDATA[ <?php $NextURL = $PrevURL = false; ?> <?php if ($_zp_gallery_page == 'image.php') { ?> <?php if (hasNextImage()) { ?>var nextURL = "<? echo html_encode(getNextImageURL()); $NextURL = true; ?>";<?php } ?> <?php if (hasPrevImage()) { ?>var prevURL = "<? echo html_encode(getPrevImageURL()); $PrevURL = true; ?>";<?php } ?> <?php } else { ?> <?php if ((function_exists('checkForPage')) && (is_NewsArticle())) { ?> <?php if (getNextNewsURL()) { $article_url = getNextNewsURL(); ?>var nextURL = "<?php echo html_decode($article_url['link']); $NextURL = true; ?>";<?php } ?> <?php if (getPrevNewsURL()) { $article_url = getPrevNewsURL(); ?>var prevURL = "<?php echo html_decode($article_url['link']); $PrevURL = true; ?>";<?php } ?> <?php } ?> <?php } ?> 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)) { <?php if ($NextURL) { ?>window.location.href = nextURL; <?php } ?>return false; } break; case 63234: case 37: if (e.ctrlKey || (docElem.scrollLeft == 0)) { <?php if ($PrevURL) { ?>window.location.href = prevURL; <?php } ?>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; }); //]]> </script> <?php } ?> ` |