I am not great with Javascript and I am currently trying to add an accordion function to a div so I can reveal additional details. This is my current mobile website, http://txf4199.cias.rit.edu/mobile-test-4/index.html#work
The issue: I can click on "View More" and the accordion effect would work fine as it reveals content. However, if I use the filter on top of the site ("Mobile", "Motion", etc.), the accordion effect won't work anymore.
FYI: The filter is using quicksand.js (a filtering plugin) & also main.js (a custom script), but the accordion effect is simply using an inline script since it's so small.
Here is a list of my js files:
<!-- jQuery -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="js/jquery.quicksand.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$('.accordionButton').click(function() {
$(this).next().slideToggle();
});
});
</script>
I've already looked up document ready functions, thought that more than one would be the issue but it's acceptable so I don't know where else to look. Any help would be appreciated, I'll be watching this post like a hawk, thank you in advance!
$(document).on('pageinit','[data-role=page]',(function() { $('.accordionButton').click(function() { $(this).next().slideToggle(); }); });
Hope I did it right... As for the plugin, there's no recent update. Oh one more thing, you mentioned that I could animate myself w jquery, could you give me an example of how that could work? I'm just looking for a simple slide up/down effect – sydas Apr 10 '12 at 03:20