Click here to Skip to main content
14,606,278 members

JavaScript

 
QuestionI am creating a program with Visual Basic Script files with C++. Pin
c0d3r1/226-Jun-20 7:15
Memberc0d3r1/226-Jun-20 7:15 
AnswerRe: I am creating a program with Visual Basic Script files with C++. Pin
Bohdan Stupak29-Jun-20 4:18
professionalBohdan Stupak29-Jun-20 4:18 
AnswerRe: I am creating a program with Visual Basic Script files with C++. Pin
ZurdoDev29-Jun-20 4:35
mveZurdoDev29-Jun-20 4:35 
Questionhow to get audio play auto work in mobile browsers andriod & ios Pin
Member 1486961821-Jun-20 20:38
MemberMember 1486961821-Jun-20 20:38 
QuestionNeed javascript code support for below request Pin
mikt201618-Jun-20 0:57
Membermikt201618-Jun-20 0:57 
AnswerRe: Need javascript code support for below request Pin
ZurdoDev18-Jun-20 2:00
mveZurdoDev18-Jun-20 2:00 
AnswerRe: Need javascript code support for below request Pin
Richard MacCutchan18-Jun-20 4:43
mveRichard MacCutchan18-Jun-20 4:43 
QuestionAccordion not working properly with dynamic content Pin
mhutch2617-Jun-20 4:09
Membermhutch2617-Jun-20 4:09 
a newbie here...

I have an accordion that's content is being brought in through includes. The accordion is showing up but with all the tabs in the open position and they won't toggle open/close. I'm completely stuck on how to get these to work with the accordion content being brought in dynamically.

This is the code that works on the normal content accordions:

(function($, window, document, undefined) {
'use strict';

$(document).ready(function() {

    /**
     * Accordions ===========================
     * Save DOM selectors.
     */
    var $container_class = $('.accordions');
    var $default_class = $('.beefup');
    var $toggle_buttons_class = $('.toggle-buttons');

    /**
     * default options.
     */
    var $default_options = {
        openSingle: true,
        openSpeed: 300,
        closeSpeed: 300
    };

    /**
     * default settings.
     */

    // we have accordions selector?
    if ($container_class.length) {

        // loop throw main containers
        $container_class.each(function() {

            // we have beefup selector?
            if ($default_class.length) {
                $(this).find($default_class).beefup($default_options);
            }

        });

    }

    // we have toggle buttons selector?
    if ($toggle_buttons_class.length) {

        $toggle_buttons_class.each(function() {

            var $this = $(this);
            var $beefup = $this.find($default_class).beefup($default_options);

            // open all
            $this.find('.toggle-open-all').on('click', function() {
                $beefup.open();
            });

            // close all
            $this.find('.toggle-close-all').on('click', function() {
                $beefup.close();
            });

            // open accordion using button
            $this.find('.buttons-group').find('.button').each(function(index) {
                $(this).on('click', function() {

                    if (!$(this).hasClass('toggle-open-all') && !$(this).hasClass('toggle-close-all')) {

                        $this.find($container_class).find($default_class).each(function(item) {

                            if (index === item) {
                                $beefup.click($(this));
                            }

                        });

                    }

                });
            });

        });

    }


The classes are different for the dynamic accordion, I tried to change them in a duplicated section of this JS, but no luck.

The page if wish to view is here: http://clear-talk.oiw11.com/motorola/bpr40.htm It's the section towards the bottom of the page under the "accessories" tab.

I'm wondering if there's a better/easier way to go about this.

Any and all help would be greatly appreciated.

Thank you in advance!
QuestionData from one page to another with a twist. Pin
and180y14-Jun-20 10:33
Memberand180y14-Jun-20 10:33 
AnswerRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 0:41
mveRichard Deeming15-Jun-20 0:41 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 1:00
Memberand180y15-Jun-20 1:00 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 1:15
mveRichard Deeming15-Jun-20 1:15 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 1:24
Memberand180y15-Jun-20 1:24 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 1:27
mveRichard Deeming15-Jun-20 1:27 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 1:46
Memberand180y15-Jun-20 1:46 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 4:59
mveRichard Deeming15-Jun-20 4:59 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 8:56
Memberand180y15-Jun-20 8:56 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 8:58
mveRichard Deeming15-Jun-20 8:58 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 9:07
Memberand180y15-Jun-20 9:07 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 9:16
mveRichard Deeming15-Jun-20 9:16 
QuestionJavascript function error. Pin
and180y9-Jun-20 13:55
Memberand180y9-Jun-20 13:55 
AnswerRe: Javascript function error. Pin
Richard MacCutchan9-Jun-20 21:03
mveRichard MacCutchan9-Jun-20 21:03 
GeneralRe: Javascript function error. Pin
and180y9-Jun-20 23:27
Memberand180y9-Jun-20 23:27 
GeneralRe: Javascript function error. Pin
Richard MacCutchan9-Jun-20 23:36
mveRichard MacCutchan9-Jun-20 23:36 
GeneralRe: Javascript function error. Pin
and180y10-Jun-20 0:21
Memberand180y10-Jun-20 0:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.