javascript - Want to arrange css divs in a proper way -


Please, answer / help me.

I have three div with CSS and it is dynamically generated.

And I call them wincontainer , smalldiv and largediv . wincontainer is a container smalldiv and largediv as we can see in the image.

Enter image details here

Div s properties

    

As we can see, we have 2 largediv s and 4 smalldiv s which are dynamically ready yet < / P>

Question: I want to arrange a small div in a proper way. Picture like this picture.1). But they are coming in the form of figs (2)

As I said I can not make sub wrappers because they generate dynamic and very important serial intelligent ... if I make subwrapper then according to this serial

Note: I do not have another specific div to include smalldiv or largediv to isolate it Because that small and big div is in accordance with a serial so we have a special Can not put into containers and they are dynamic.

In JSFIDDLE - & gt; It will work fine when you remove the upper most ultraviolet, but when you add a small ball to the top, it becomes crazy. I want to fix it and make it properly in the unlimited space.

A div will either be largediv or small, each can have a variable number and can appear in any order. All are largely contained in small and small Wintakner. Additional markup is not allowed

Here is an option for which Javascript is required:

  $ (document) .ready (function () {var containertop = $ ('container') [0] .offetop, lpos = containerTop, rpos = containerTop; $ ('. Container & Gt; div '). Each (function) ($ L.hasClass (' big ')) {if (lpos & lt; el.offsetTop) {$ el.css (' margin-top ', (lpos - el.offsetTop ) + "Px")}} lpos + = $ el.height ();} and if ($ el HasClass ('small')) {if (rpos & lt; el.offsetTop) {$ El.css ('margin-top', (rpos-el.offsetTop) + "px")}}} rpos + = $ el Height ();}}};});   

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -