• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to use jQuery function call inside AgentPress Pro Custom HTML widget?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › How to use jQuery function call inside AgentPress Pro Custom HTML widget?

This topic is: resolved

Tagged: Agentpress Pro

  • This topic has 3 replies, 3 voices, and was last updated 4 years, 9 months ago by MaryDu.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • May 31, 2018 at 3:14 pm #220428
    MaryDu
    Member

    I am having problem to use the jQuery function to display dynamic number count up inside the Custom HTML widget. If I put the script inside the HTML code, in the editing mold it shows working but not working when display the page. So I moved the jQuery function into the function.php under the Theme directory and registered the function using:

    add_action( 'wp_enqueue_scripts', 'add_counter_script' );
    function add_counter_script() {
    wp_enqueue_script(
    'NumberCounter',
    get_template_directory_uri() . '/js/NumberCounter.js',
    array('jquery')
    );
    }

    My NumberCounter.js file is like this:
    jQuery(document).ready(function($) {
    $('.count').each(function () {
    $(this).prop('Counter',0).animate({
    Counter: $(this).text()
    }, {
    duration: 4000,
    easing: 'swing',
    step: function (now) {
    $(this).text(Math.ceil(now));
    }
    });
    });
    })

    It is still not working. Which part did I do wrong? Please help!

    http://ciciwang.co.nz/
    May 31, 2018 at 4:10 pm #220429
    Victor Font
    Moderator

    The counter is working fine.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    May 31, 2018 at 5:28 pm #220432
    Brad Dalton
    Participant

    https://www.studiopress.community/topic/agentpress-pro-theme-front-page-custom-html-calling-jquery-count-up-function/#post-220431


    Tutorials for StudioPress Themes.

    May 31, 2018 at 7:32 pm #220434
    MaryDu
    Member

    Thank you so much Victor and Braddalton! I found the solution - without creating any extra function, inside the HTML I simply changed all $ sign to JQuery which make it work! Thank you guys for following up! Very appreciate that 🙂

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘How to use jQuery function call inside AgentPress Pro Custom HTML widget?’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble