Solved

JavaScript Collapse Box  IMG

Posted on 2010-11-23
4
402 Views
Last Modified: 2012-06-27
I am working in Drupal with a collapseable javascript box.  At the moment, We have Text which you click to open and close the box. What we want to do, and are trying to do, is in place of text, we want an image(Button) to be click-able to open and close the box.

I have tried just inserting an image, but when you click the image button, the box collapses and so does the button, and you are unable to open the box again. If after the button i put a single character in this case "X" i can click the image, to close the box, but only the "X" appears on the closed box.

I have attached a screenshot of the button and X, also the code and file of the collapsible.js.

Could somebody help me with this please.

// Turn the legend into a clickable link and wrap the contents of the fieldset
    // in a div for easier animation
    var text = this.innerHTML;
      $(this).empty().append($('<a href="#">'+ text +'</a>').click(function() {
        var fieldset = $(this).parents('fieldset:first')[0];
        // Don't animate multiple times
        if (!fieldset.animating) {
          fieldset.animating = true;
          Drupal.toggleFieldset(fieldset);
        }
        return false;
      }))
      .after($('<div class="fieldset-wrapper"></div>')
      .append(fieldset.children(':not(legend):not(.action)')))
      .addClass('collapse-processed');

Open in new window


 
 
0
Comment
Question by:jonathan1978
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 6

Accepted Solution

by:
Codebot earned 500 total points
ID: 34203422
Hi
you can use  div or span  and then call function on onclick event of div.
0
 

Author Comment

by:jonathan1978
ID: 34209766
Sorry to ask, but how would i do that ?
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question