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

    Is it possible to have a close button under the content in the accordion?

    or

    Is it possible to add more content above the tab?? Where the title it. We are tasked to have an image, header text and then a button to open the content.

    Thank you

    #1361235

    Hey finchkelsey,
    Thanks for your question, if you have the accordion set to “open one at a time” then each time you click the title the accordion open or closes, and you should be seeing a plus or minus icon next to the title, this could be your button? The full title is basically a button. You can also added more text to the title, I don’t think there is a limit.
    Perhaps if you could link to a mockup we could understand better.
    If you find the accordion too limiting in style you could use jQuery to toggle visibility of an element, here is an example.
    Perhaps this could work if you added a button and image inside of a text element and on load only the button and text showed with clicking the button shows the image?
    If you think that using other elements would help then try linking to a test page and explain the behavior and perhaps we could help or understand better.

    Best regards,
    Mike

    #1361313

    Hi Mike,

    See the link below for a mock up.

    The agency has laid out a feature image/video, title, text and then a ‘button’ to expand the content. So I am using the accordion only once per section. So multiple sections do not equal one accordion, but many accordion on the page with one tab.

    Also they have mocked up a full width image that when clicked plays a video. I cannot find a ALB solution for this either. gerrr. I have tried the video player and now the fill width slider but the video plays onload no matter what settings I add..

    ?rel=0&autoplay=0&iframe=true&showinfo=0

    So now I have the two issues with this pretty simple ask from the agency. Please advise..

    #1361392

    Hi,
    Thank you for the link to your test page, please try this script to add a close button inside the toggle content, add this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function custom_close_button_script() { ?>
      <script>
    (function($){
    	var close = $('<span class="close_button"></span>');
    $('.single_toggle .toggle_content').prepend(close);
    $('.close_button').click(function() {
          $(this).parents('.toggle_wrap.active_tc').removeClass('active_tc');
      });
    })(jQuery);
    </script>
      <?php
    }
    add_action('wp_footer', 'custom_close_button_script');

    and then this css:

    .close_button {
        position:relative;
        float:right;
        display:block;
        height:50px;
        width:50px;
        background: url(https://img.icons8.com/ios/50/000000/cancel.png) no-repeat;
        background-color:#fff;
        border-radius:25px;
        -moz-border-radius:25px;
        -webkit-border-radius:25px;
    }
    .close_button:hover {
    	cursor: pointer;
    }
    

    this is the expected results:
    2022-08-10_001.jpg

    As for your video, it is not auto playing for me, but does play on click. I tested in Windows with Chrome, Firefox, & Edge.

    Best regards,
    Mike

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