views:

259

answers:

3
$('#global').show("explode", { number: 50}, 2000);

I tried this code but it doesn't seem to work properly. It looks like it's limited i never got more than 8/10 exploding blocks.

Are there a maximum ? Any ideas ?

the explode effect is a native effect from the jquery-ui

+2  A: 

Just checked out the code.

var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;

There does not seem to be a limit on the number of pieces. This statement just checks if you have passed in a number of pieces and if yes calculates rows and cells, otherwise it defaults to 9 pieces.

With 50 pieces being passed in, going through the calculation of Round(SquareRoot(50)); we get 7 rows and 7 columns. That should result in 49 pieces.

Dmitri Farkov
Yes thanks for your answer, i just checked out the code too, and indeed, there does not seem to be a limit...And i still don't understand then...Thanks for your answer anyway !
Boris Guéry
What is the size of the element?
Dmitri Farkov
+3  A: 

I think the option you need to pass in is 'pieces', not 'number'.

$('#global').show("explode", { pieces: 50}, 2000);
great_llama
No as shown on the jQuery documentation page:$("div").click(function () { $(this).hide("explode", { number: 9 }, 1000);});
Dmitri Farkov
Where did you see that ?Because i just copied/pasted from JQuery websitehttp://docs.jquery.com/UI/Effects/ExplodeAnd it's written: """Hides the element by exploding it into 9 pieces.$("div").click(function () { $(this).hide("explode", { number: 9 }, 1000);});"""
Boris Guéry
Well it seems that you are right !Thank you, but i'm still curious to know where did you get it ? Because it's not metionned anywere on the explode effects page on jquery website.
Boris Guéry
There, I fixed the documentation page.
GoodEnough
I read the code that Dmitri posted, and it's reading 'pieces' from the options array. I assumed that Dmitri copied those 2 lines and didn't type them himeself...
great_llama
I was getting suspicious at the point you pointed that out. Odd that their documentation page worked too.Yeah I copy and pasted it from the jqueryui.explode code file.
Dmitri Farkov
It's not odd, if the nothing is set for 'pieces' then it's set to 9 (3x3) as pointed out by yourself Dmitri. So they could have specified anything as the value for number and it wouldn't have mattered. I'll try to improve the documentation.
GoodEnough
+2  A: 

A jQuery Effects Cheat sheet shows to uses pieces instead of number

TStamper