/*
Theme Name: Overton
Theme URI: https://overton.qodeinteractive.com
Description: A Creative Multi-Concept Theme for Agencies and Freelancers
Author: Mikado Themes
Author URI: https://themeforest.net/user/mikado-themes
Text Domain: overton
Tags: one-column, two-columns, three-columns, four-columns, left-sidebar, right-sidebar, custom-menu, featured-images, flexible-header, post-formats, sticky-post, threaded-comments, translation-ready
Version: 1.6
License: GNU General Public License
License URI: licence/GPL.txt

CSS changes can be made in files in the /css/ folder. This is a placeholder file required by WordPress, so do not delete it.

*/
jQuery(document).ready(function($) {
    
    // Fix for Interactive Pair right box click functionality
    $('.mkdf-interactive-pair').each(function() {
        var $pair = $(this);
        var $rightBox = $pair.find('.mkdf-ip-right-holder');
        var $leftBox = $pair.find('.mkdf-ip-left-holder');
        
        // Remove existing event handlers to prevent conflicts
        $rightBox.off('click');
        $leftBox.off('click');
        
        // Re-implement left box click handler
        $leftBox.on('click', function(e) {
            e.preventDefault();
            var leftLink = $pair.find('[data-link]').attr('data-link') || 
                          $pair.attr('data-link') ||
                          $(this).find('a').attr('href');
            
            if (leftLink && leftLink !== '#') {
                window.location.href = leftLink;
            } else {
                // If no link, show left content
                $pair.find('.mkdf-ip-content-left').slideDown();
                $pair.find('.mkdf-ip-content-right').slideUp();
            }
        });
        
        // Implement corrected right box click handler
        $rightBox.on('click', function(e) {
            e.preventDefault();
            var rightLink = $pair.find('[data-link-right]').attr('data-link-right') ||
                           $pair.attr('data-link-right') ||
                           $(this).find('a').attr('href');
            
            if (rightLink && rightLink !== '#') {
                window.location.href = rightLink;
            } else {
                // If no link, show right content
                $pair.find('.mkdf-ip-content-right').slideDown();
                $pair.find('.mkdf-ip-content-left').slideUp();
            }
        });
    });
    
});