Tagged: , ,

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #311132

    Hello,

    I am trying to add my own customer jquery and have tried it in numerous locations in the theme files and nothing has seemed to initiate them

    What file and where could I place custom jquery to where it will be initiated and run on load?

    I am trying to add this

    $(document).ready(function() {
    $(“#nav1”).click(function() {
    $(‘html,body’).animate({
    scrollTop: $(“#why”).offset().top},’slow’);
    });

    $(“#nav2”).click(function() {
    $(‘html,body’).animate({
    scrollTop: $(“#why2”).offset().top},’slow’);
    });

    $(“#nav3”).click(function() {

    $(‘html,body’).animate({
    scrollTop: $(“#product”).offset().top},’slow’);
    });

    $(“#nav4”).click(function() {
    $(‘html,body’).animate({
    scrollTop: $(“#how”).offset().top},’slow’);
    });

    $(“#nav5”).click(function() {
    $(‘html,body’).animate({
    scrollTop: $(“#contact”).offset().top},’slow’);
    });
    });

    #311208

    Hey!

    Try adding this at the very end of your theme / child theme functions.php file:

    function add_customjs() {
       wp_enqueue_script( 'customjs', get_stylesheet_directory_uri().'/js/custom.js', array('jquery'), 2, true );
    }
    add_action( 'wp_enqueue_scripts', 'add_customjs', 100 );
    

    Adjust as needed.

    Cheers!
    Josue

    #311648

    Thank you Josue, I’ll try it out!

    #311650

    You are welcome, let us know if you need something else :)

    Regards,
    Josue

    #322104
    This reply has been marked as private.
    #322125

    Hey Colin!

    The code i suggested was meant to be used in a child theme installation. Alternatively If you don’t want to do that yet; you can put any custom JS here (wrap it in <script></script> tags):
    http://screencast.com/t/opsRshUq7RY

    Cheers!
    Josue

    #480148

    Dear Josue,

    the screencast is down. Could you tell me where to put custom js code?

    Thanks
    Bernd

    #481127

    Hey Bernd!

    I believe i was referring to the GA field in the Theme Options:
    http://screencast.com/t/4X7FSZ7ipS

    Regards,
    Josue

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