Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 04:16:16 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155543 Posts in 21714 Topics by 7736 Members
Latest Member: chris85
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: toggle me question?  (Read 512 times)
Roych

Offline Offline

Posts: 149



« on: April 06, 2011, 10:52:45 AM »

Hello

I need some help with toggleme module.
The module itself is working fine, I would only like to achieve that if I there is one "question" in the list opened and if I click on another one the first one would close automaticaly. Hope you understand my question.

Is this possible with toggleme module?

Thank you in advance.

Roych
Logged
instantflorian
Betatester
*
Offline Offline

Posts: 804



WWW
« Reply #1 on: April 06, 2011, 03:08:16 PM »

Hi,

yes it is, but you need the jquery Admin and have to edit the view.php of the module. See modified module which is attached to this posting. (The frontend.js of the module is'nt needed any more, but I don't know how to get rid of the call.)

In the jQuery admin, create a preset called "accordion" which uses (surprise) UI > Accordion

Then change the options of the toogle module for the head to
Code:
[[jQueryInclude?preset=accordion]]
<div id="accordion">

and for the footer to
Code:
</div>

Then only one toggle will stay open and the toggling runs smooth.

No warranty it works, it probably won't if you use it together with modules which use mootools or bring their own jquery call...

BR
-instantflorian.
Logged
Roych

Offline Offline

Posts: 149



« Reply #2 on: April 06, 2011, 05:29:00 PM »

Thanks for the anwser  wink

I tryed this but don't know what to change in view.php.

If I don't change anything and only add

Code:
[[jQueryInclude?preset=accordion]]
<div id="accordion">

and for the footer
Code:
</div>

Then only some of them are working and it hides categories, it's all  messy!

any idea?
Logged
marmot

Offline Offline

Posts: 208


« Reply #3 on: April 06, 2011, 08:55:10 PM »

Hi,
I extended the frontend.js of the original ToggleMe module:
Code:
function toggleMe(a){

var divs=document.getElementsByTagName('div');
for (var i = 0; i<divs.length; i++) {
if (divs[i].getAttribute('class') == 'answer' && divs[i].id != a) {
divs[i].style.display="none";
};
};
  var e=document.getElementById(a);
  if(!e)return true;
  if(e.style.display=="none"){
    e.style.display="block"
  } else {
    e.style.display="none"
  }
  return true;
}
Works fine for me in IE 8 and FF 3. Only one answer is opened at a time. Maybe you want to do some more tests and give some feedback.

regards
Logged
Roych

Offline Offline

Posts: 149



« Reply #4 on: April 07, 2011, 10:39:33 AM »

marmot!

You are a life saviour! It works perfect!  wink

This should be implemented in the original file in AMASP also.

Thank you very much!
Logged
Roych

Offline Offline

Posts: 149



« Reply #5 on: April 07, 2011, 10:44:49 AM »

Ups too fast!  tongue

It doesen't work in IE8 for me! works in Chrome and firefox.

hmmm! any idea!

Thank you

R

Logged
marmot

Offline Offline

Posts: 208


« Reply #6 on: April 07, 2011, 09:29:39 PM »

Hi,
I tried IE 8, works fine. But maybe you tested a lot. It's always a good idea to clean the browser cache. I do this by checking Internet Options > General > Brosing History > Settings > every time i visit the webpage.
If that doesn't help pls explain the problem more detailed.

regards
Logged
Roych

Offline Offline

Posts: 149



« Reply #7 on: April 10, 2011, 02:56:21 PM »

sorry for the delay.

Yes. I deleted the history and now it's working. I didn't thought of that. Thanx Wink Great module!

Roych
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!