• 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

AgentPress Pro theme front page Custom HTML calling jQuery Count Up function

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 › Design Tips and Tricks › AgentPress Pro theme front page Custom HTML calling jQuery Count Up function

This topic is: resolved

Tagged: Agentpress Pro

  • This topic has 2 replies, 2 voices, and was last updated 4 years, 9 months ago by MaryDu.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • May 31, 2018 at 3:11 pm #220427
    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 5:28 pm #220431
    Brad Dalton
    Participant

    Works when i test it and there are no js errors.


    Tutorials for StudioPress Themes.

    May 31, 2018 at 7:35 pm #220435
    MaryDu
    Member

    Thank you Braddalton! I fixed the problem by simply changed all $ to JQuery inside the <script>. I figured out the solution by seeing the tips on using JQuery inside WordPress 🙂

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘AgentPress Pro theme front page Custom HTML calling jQuery Count Up function’ 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