Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1262801

    Hi there,

    found this cool solution to toggle some content:

    I want to use it 3 Times on the same page.. so I expand the function:
    add_action(‘wp_footer’, ‘ava_custom_script’, 10);
    function ava_custom_script(){
    (function($) {
    $(‘.click-learn-more’).on(‘click’, function() {
    $(‘.click-learn-more2’).on(‘click’, function() {

    Is there a way that the open one closed, when I click another one?

    Thank you very much in advance! KiM


    Hey Blatze,
    Sorry for the late very reply, I rewrote this script a little and added a “span” around each content “block”. I created a test page on your site so you could examine a working example, please see the link in the Private Content area.
    This is the HTML I used in a code block element on the test page:

    <span class="learn-more">Opening content
    <a class="click-learn-more" href="#">Learn more…</a>
    <span class="learn-this">Toggled content</span>

    I then cloned the code block 6 times.
    This is the function I added to your functions.php, I also disabled your other function and css.

    function custom_toggle_script() { ?>
        var $this = $(this).parent().find('.learn-this');
    add_action('wp_footer', 'custom_toggle_script');

    now on the test page only one toggle will be open at a time.

    Best regards,


    Hey Mike!

    Thank you very much for your help! :)

    Best KiM


    Hi Blatze,

    Glad we could help :)

    If you need further assistance please let us know.
    Best regards,

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Toogle content’ is closed to new replies.