I'm having a double click issue activating jQuery function

14
April 16, 2018, at 07:18 AM

I've found similar answers that solve the double click issue when first calling a jQuery function, usually from having a click() function inside another click() or missing the $(document).ready. None of these solutions have solved the issue for me. When the page first loads I have to click once on the button and then a second time to activate the function. Oddly, this is only an issue in Firefox and it performs correctly in Chrome.

HTML:

<li class="nav-item">
<a id="resize-fix" class="nav-link full-button" alt="Full-Width Resize" title="Full-Width Resize"><i class="lnr lnr-frame-expand"></i></a>
</li>

JavaScript:

$(document).ready(function(){
if ($.cookie('fullscreen') == "yes") {
        $('#resize-fix').find('i').removeClass('lnr-frame-expand');
        $('#resize-fix').find('i').addClass('lnr-frame-contract');
        $('.container').addClass('box-full');
    }
    // When the icon is clicked
    $("#resize-fix").click(function () {
        // Check the current cookie value
        // If the cookie is empty or set to no, then add fullscreen
        if ($.cookie('fullscreen') == "undefined" || $.cookie('fullscreen') == "no") {
            // Set cookie value to yes
            $.cookie('fullscreen','yes', {expires: 7, path: '/'});
            // Add the class to the container
            $(this).find('i').toggleClass('lnr-frame-expand lnr-frame-contract');
            $('.container').addClass('box-full');
        }
        // If the cookie was already set to yes then remove it
        else {
            $.cookie('fullscreen','no',  {expires: 7, path: '/'});
            // Remove the class from the container
            $(this).find('i').toggleClass('lnr-frame-expand lnr-frame-contract');
            $('.container').removeClass('box-full');
        }
    });
});
READ ALSO
Reset CKEditor5 form

Reset CKEditor5 form

Sorry if this has been discussed before, but I have searched exhaustively and only found solutions to the older version, not 5I want to have two buttons for my forms, SEND and RESET

22
One button works, the other one doesn&#39;t

One button works, the other one doesn't

I have two input buttonsOne to set the MySQL database value to 0 the other to set it to 1

14
Same JavaScript file for multiple JSON files, but selecting which JSON data is shown in a specific part of the site

Same JavaScript file for multiple JSON files, but selecting which JSON data is shown in a specific part of the site

I am trying to set-up a website which would contain multiple quizzes - all on a different topic but all in the same multiple-choice formatWhat I would like to do is have each topic placed in different parts of the website (something I am doing with HTML/CSS)

38
Intercept all outgoing requests

Intercept all outgoing requests

In short, is there any way to intercept all outgoing requests in a page in order to append an Authorization token to the header prior to sending the request? This includes all requests that are out of the control of the user (non-clickable ones) such as request...

40