Close

Account

Documentation

Forum

Menu

Execute custom Javascript?

  • Post count: 9
    SupaRub
    January 31, 2015 at 3:19 pm #8753

    Even when waypoints.js is loaded, I cannot execute a simple command I put in “Jkreativ > Additional Javascript”

    code:

    $(‘#myID’).waypoint(function(direction) {
    alert(‘Top of notify element hit top of viewport.’);
    });

    How can it be fixed?

    Post count: 6436
    Adek
    February 3, 2015 at 9:05 am #8787

    Hi SupaRub,

    Can you provide me the url of the page that you add the code above? I will check it directly.

    Thank you

    Post count: 9
    SupaRub
    February 4, 2015 at 6:29 pm #8828

    Yes, here is the url: http://paris.solarsoundsystem.test.horus.ch/

    And the final code:

    $(‘#booking’).waypoint(function(direction) {
    alert(‘Top of notify element hit top of viewport.’);
    });

    Thanks

    Post count: 6436
    Adek
    February 7, 2015 at 7:53 am #8901

    Hi SupaRub,

    You will need to make several change on those code. Even i just try to use this line alert(‘Top of notify element hit top of viewport.’); on Additional JavaScript it doesn’t work. You will need wrap your message with '' or "" so it look like alert("Top of notify element hit top of viewport."); and also make another change.

    Thank you

    Post count: 9
    SupaRub
    February 7, 2015 at 8:23 pm #8928

    Hello Dek;

    So Ive tried with those codes:

    But still nothing, the message appears on other websites.

    Post count: 6436
    Adek
    February 12, 2015 at 7:28 am #9097

    Hi SupaRub,

    Sorry for late reply your message. Anyway, as i said previously, you will need to make several change on your code to make it works.

    Or you can place those code (without any changes) on this file jkreativ-themes/js/internal/jquery.jlanding.js and paste your code above on line 559. Then copy all content on those file, and go to this file jkreativ-themes/js/internalmin/jquery.jlanding.js replace all content on this file. (overwrite this file into content of previously edited file)

    Thank you

    Post count: 9
    SupaRub
    February 12, 2015 at 8:44 am #9126

    Thank you Dek Ery, will do.

    In this case what is the purpose of having a custom JavaScript section in the theme if we have to manually edit files?

    Post count: 6436
    Adek
    February 12, 2015 at 9:13 am #9130

    Hi SupaRub,

    Actually one of the reason we provide those option avoid our customer to edit the original theme files because when they update the themes into newer version, their custom code will lost. But in this case you will need to make several change on your code above to make it works when you put them on Additional JavaScript. But you can still use those code if you put them on the js file that i tell you previously.

    Thank you

    Post count: 9
    SupaRub
    February 17, 2015 at 5:07 pm #9418

    Hi Dek Ery;

    So I tried as you told me, modifying both:

    /jkreativ-child/public/js/internal/jquery.jlanding.js
    /jkreativ-child/public/js/internalmin/jquery.jlanding.js

    & adding just before line 559, without modifying the quotes the following code:

    $(‘#booking’).waypoint(function(direction) {
    alert(‘Top of notify element hit top of viewport.’);
    });

    I also tried with this one:

    var waypoint = new Waypoint({
    element: document.getElementById(‘#booking’),
    handler: function(direction) {
    console.log(‘Scrolled to waypoint!’)
    }
    })

    but nothing works, any clues?

    Post count: 9
    SupaRub
    February 17, 2015 at 6:34 pm #9420

    Its ok succeeded with

    $(function(){
    $(‘#bonboklat’).waypoint(function() {
    alert(‘The element appeared on the screen.’);
    });
    });

    :))))))))

    Post count: 6436
    Adek
    February 20, 2015 at 3:53 am #9452

    Glad to hear that 🙂

You must be logged in to reply to this topic.