Hi there! I dont really want to learn how to develop WP plugins. I spend many time in develop PHP code for non-cms*bassed sites. This is the reason cause I publish this ‘tip’. This is a demo about how you can use ajax slides effect, etc. on your WP posts or theme pages.
I found the main-idea at the mootools demos page. Its bassed on Fx.Slide. See the preview at the end of this post.
Download this tutorial (txt)
For this, I needed to:
Add some styles rule to the theme css sheet. (wp-content/themes/<theme_name>/style.css)
dl { width: 600px; }
dl,dd { margin: 0; }
dt {
background: #49c6dd;
font-size: 1px;
padding: 5px;
margin: 2px;
}
dt a { color: #FFF; }
dd a { color: #000; }
ul { list-style: none; padding: 5px; }
Add the javascripts in the header.php theme file. (wp-content/themes/<theme_name>/header.php)
<script src=”http://jquery.com/src/jquery.js”></script>
<script type=”text/javascript”>
$(document).ready(function(){
$(”dd:not(:first)”).hide();
$(”dt a”).click(function(){
$(”dd:visible”).slideUp(”slow”);
$(this).parent().next().slideDown(”slow”);
return false;
});
});
</script>
And finally, the HTML code:
<dl>
<dt><a href=”#”><strong>Title 1</strong></a></dt>
<dd>This is the content n1</dd>
<dt><a href=”#”><strong>Title 2</strong></a></dt>
<dd>This is the content n2</dd>
</dl>
|
Title 1 |