MyBB Community Forums

Full Version: How can I replace the collapse with this?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I want to replace the original collapse jscript with this jQuery - http://www.adipalaz.com/experiments/jque...#moredemos

3.Fade In/Out - Heading/Div
jQuery slideFadeToggle effect - slideFadeToggle("slow")

Some help please Big Grin
that looks really cool bro, hope it works because i might try this. Big Grin
Thanks I've seen it before well something like it done on other forums just when I ask I never get a answer back Toungue
Any help on this please Smile
You can do this with prototype and scriptaculous effects.
http://madrobby.github.com/scriptaculous/effect-fade/

This way you don't have to load a whole new framework, you can use the existing prototype.

Ask combus I believe hes done this in some fashion on IndiePaper.
I know combus I asked him I think some time ago he never answered me so no help there.
@G33K could you tell me where exactly do I add this?
First, you need to add the effects library:

In your headerinclude template:

AFTER
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/prototype.js?ver=1600"></script>

ADD
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/effects.js?ver=1600"></script>

Next you need to edit the general.js file

Around line 745

Find:
expandedItem.show();

Replace with
				Effect.SlideDown(expandedItem, { duration: 0.25, transition: Effect.Transitions.sinoidal });
				Effect.Appear(expandedItem, { duration: 1.0 });


Around line 754:

Find:
expandedItem.hide();

Replace with:
				new Effect.Fade(expandedItem, {	duration: 1.0, afterFinish: function() {
						Effect.SlideUp(expandedItem, { duration: 0.25, transition: Effect.Transitions.sinoidal });
					}
				});


The above shows 2 different ways of using the effects, you can play around with the effects, duration and transitional effects to get the kind of effect you desire. You can even chain effects or run them synchronously.

One note though: jscript effects work best on divs, so if you find your effects are jumpy and not smooth, its probably because the effects are not on divs, it is best to add divs to make the effects smooth.
Cool thanks Smile
Umm one more question where do I put the divs? :p
I saw this thread and wanted to try it and it works, but it's not smooth when you click the collapse button, so like he said, so where do i add the divs?
Pages: 1 2