[Support request] Code snippets script doesn\'t work

Home Forums Support [Support request] Code snippets script doesn\'t work

Home Forums Support Code snippets script doesn\'t work

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1068157
    Lilia

    `Dear great GeneratePress team,
    I have little Problem!

    after some updates a popup script does not work on my homepage

    myCookieConsent script! https://www.eu-rights.com/

    I creat elements Hook

    <div>
    <a>Weiter</a>
    <div>Durch die weitere Nutzung der Seite stimmst du der Verwendung von Cookies zu<a href=”https://www.eu-rights.com/datenschutz-hinweis-eu-rigths-fluggastrechte-team/”>Mehr lesen</a></div>
    </div>

    Code Snippets js
    add_action( ‘wp_head’, function () { ?>
    <script>

    // Cookie Compliancy BEGIN
    function GetCookie(name) {
    var arg=name+”=”;
    var alen=arg.length;
    var clen=document.cookie.length;
    var i=0;
    while (i<clen) {
    var j=i+alen;
    if (document.cookie.substring(i,j)==arg)
    return “here”;
    i=document.cookie.indexOf(” “,i)+1;
    if (i==0) break;
    }
    return null;
    }
    function testFirstCookie(){
    var offset = new Date().getTimezoneOffset();
    if ((offset >= -180) && (offset <= 0)) { // European time zones
    var visit=GetCookie(“cookieCompliancyAccepted”);
    if (visit==null){
    $(“#myCookieConsent”).delay(5000).fadeIn(4000); // Show warning
    } else {
    // Already accepted
    }
    }
    }
    $(document).ready(function(){
    $(“#cookieButton”).click(function(){
    console.log(‘Understood’);
    var expire=new Date();
    expire=new Date(expire.getTime()+7776000000);
    document.cookie=”cookieCompliancyAccepted=here; expires=”+expire+”;path=/”;
    $(“#myCookieConsent”).hide(400);
    });
    testFirstCookie();
    });
    // Cookie Compliancy END

    </script>
    <?php } );

    and CSS

    /*Update Cookie Consent Begin*/

    #myCookieConsent {
    z-index: 999;
    min-height: 20px;
    font-family: Muli, arial, “sans-serif”;
    padding: 10px 20px;
    background: rgba(62,79,96,0.8);
    overflow: hidden;
    position: fixed;
    color: #FFF;
    bottom: 0px;
    right: 10px;
    display: none;
    left: 0;
    text-align: center;
    font-size: 1.25em;
    font-weight: bold;
    }
    #myCookieConsent div {
    padding: 5px 0 0;
    }
    #myCookieConsent a {
    color: #ffffff;
    display: inline-block;
    padding: 0 10px;
    }
    #myCookieConsent a:hover {
    color: #ffffff;
    }
    #myCookieConsent a#cookieButton {
    display: inline-block;
    color: #ffffff;
    font-size: 1.1em;
    background: #1fb1c1;
    text-decoration: none;
    cursor: pointer;
    padding: 2px 20px;
    float: right;
    border-radius: 20px;
    }
    #myCookieConsent a#cookieButton:hover {
    background: #21bfd1;
    color: #ffffff;
    }

    /*Update Cookie Consent END*/

    i have disabled all plugins and tried to find the error

    can you please help me?
    what I’m doing wrong!

    Best regards
    lili

    #1068270
    Leo
    Staff
    Customer Support

    Hi there,

    Have you checked with the author of the snippet?

    The theme itself wouldn’t caused errors like this so I’m not sure how much we are able to help here.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.