Hi All.
Having a little problem I would like some help with.
Using Mootools v.1.2 to make an accordion on my page. And it works fine. But I would like it to go the top of the element you clicked on (like it had an anchor).
Right now if the element opened has a lot of text and I have scrolled down to see it and then click on the next element, the start of the contents of the new element can be outside the window and I have to scroll up to get to it.
This is the java used:
<script type="text/javascript">
window.addEvent('domready', function() {
var accordion = new Accordion($$('.toggler'),$$('.element'), {
opacity: 0,
show: 0,
onActive: function(toggler) { toggler.setStyle('color', '#ff3300'); },
onBackground: function(toggler) { toggler.setStyle('color', '#000000'); }
});
});
</script>
And here is the html:
<!-- START ELEMENT 1 -->
<div id="accordion">
<a href="#bestik"]"><h3 class="toggler">Bestik</h3></a>
<div class="element">
CONTENT HERE
</div>
<!-- END ELEMENT 1 -->
<!-- START ELEMENT 2 -->
<div id="accordion">
<a href="#borde"]"><h3 class="toggler">Borde</h3></a>
<div class="element">
CONTENT HERE
</div>
<!-- END ELEMENT 2 -->
I have tried adding a a href like this this but it doesn't work:
<!-- START ELEMENT 1 -->
<a name="bestik" id="bestik"></a>
<div id="accordion">
<h3 class="toggler"><a href="#bestik"]">Bestik</a></h3>
<div class="element">
CONTENT HERE
</div>
<!-- END ELEMENT 1 -->
<!-- START ELEMENT 2 -->
<a name="borde" id="borde"></a>
<div id="accordion">
<h3 class="toggler"><a href="#borde"]">Borde</a></h3>
<div class="element">
CONTENT HERE
</div>
<!-- END ELEMENT 2 -->
Is it possible to add some code to the javascript that would act like an anchor??
Any help with this problem would be great.
Thanks in advance
Dr. Virus