www.webdeveloper.com
Results 1 to 2 of 2

Thread: PHPBB bbcode - special style when scrolling is active

  1. #1
    Join Date
    Jan 2013
    Posts
    1

    Question PHPBB bbcode - special style when scrolling is active

    Im creating a custom bbcode for phpbb, in which i need a "select all" and a "expand/collapse" function. The expand/collapse option should then have a specific style when scrolling is active.

    The select and expand/collapse work fine, but where i have a problem is when looking for if scrolling is active.

    First the scrolling and looking for it works fine, but the bbcode is not unique (only works on the first one posted) Second the getElementByTagName('testlink') for the expand/collapse link does not work.

    So quickly excplayn what i want the script to do, and what is working so far.

    • When div class is ready run function - working
    • set var for the link class (testlink) - not working
    • set var for the content div class - working
    • set var for scrolling - working
    • try to scroll content - working
    • if scrolling works scroll back up - working
    • if scrolling works set visibility of (testlink) to visible - not working
    • if no scrolling (else) set visibility of (testlink) to hidden - not working


    Javascript:
    Code:
    $(document.getElementsByTagName('pre_header')[0]).ready(
        function () {
        var expandlink = this.getElementsByTagName('testlink')[0];  
        var eee = this.getElementsByTagName('dd')[0];   
        var old = eee.scrollTop;
        eee.scrollTop += 220;
    
    
        if (eee.scrollTop > old) {
            eee.scrollTop -= 220;
            expandlink.style.visibility = "visible";
        } 
        else {
            expandlink.style.visibility = "hidden";
            };  
        }
    );
    HTML:
    Code:
    <div class="pre">
        <dt class="pre_header">
            <b>Code: </b>
            <a class="testlink" href="#">expand</a>
        </dt>
        <dd style="overflow:auto;">
            content here
        </dd>
    </div>
    Hope to get some help, and when it all done ill add the whole BBcode for others to use..

    /megaman

  2. #2
    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    227
    You seem to have mixed up classes with tag names. getElementsByTagName returns a list of elements with the specified tag name, e.g. getElementsByTagName('div') returns all <div> elements. pre_header and testlink are classes.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles