0

how to split <div></div> into even and odd parts ? And how to slide even parts to top-right & odd parts to bottom-left using jquery?

3
Contributors
7
Replies
8
Views
5 Years
Discussion Span
Last Post by AleMonteiro
0

I want to make small parts of single div for animating. I want to hide div by splitting it into small pieces with explode effect.

What do you mean by split?

0
<style>
.odd{height:5px; background:#960;}
.even{height:5px; background:#09C;}
</style>

<script src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
			$('div:odd').addClass('odd');
			$('div:even').addClass('even');
})
</script>
<body>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</body>

for more jquery selectors use
http://www.w3schools.com/jquery/jquery_ref_selectors.asp

0

These are multiple div's. I want to divide single div into even and odd parts to animate

<style>
.odd{height:5px; background:#960;}
.even{height:5px; background:#09C;}
</style>

<script src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
			$('div:odd').addClass('odd');
			$('div:even').addClass('even');
})
</script>
<body>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</body>

for more jquery selectors use
http://www.w3schools.com/jquery/jquery_ref_selectors.asp

0

Something like this?

$(function()
{
    $("#myDivID").children(":odd").animate(); // Animate odd
    $("#myDivID").children(":even").animate(); // Animate even
});
0

Hey, Thanks!

This can be used to animate div, but how to make small parts of single div?


Something like this?

$(function()
{
    $("#myDivID").children(":odd").animate(); // Animate odd
    $("#myDivID").children(":even").animate(); // Animate even
});
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.