Dyn div - following the scroll bar of the page

0

I have a div that is in the second column of the page and I wanted it to become "dynamic", that is, it followed the scrolling of the page, but even with searches, I did not get anything that could help me.

Div code:

<div class="col-2 onestep">
            <!-- RESUMO DA COMPRA -->
            <div class="cart-resume">
                <?php 
                    //Subtotal do cart
                    $subtotal = Mage::getSingleton('checkout/session')->getQuote()->getSubtotal();
                    //Total do cart
                    $total = Mage::helper('checkout/cart')->getQuote()->getGrandTotal();

                    //Formata o subtotal e total
                    $subtotal_formatado = Mage::helper('core')->currency($subtotal,true,false);
                    $total_formatado = Mage::helper('core')->currency($total,true,false);

                    //Calcula o preço da parcela em 2x e já formata
                    $parcela = Mage::helper('core')->currency(($total/2),true, false);
                ?>    
                <div>
                    <h4>RESUMO DE COMPRA</h4>
                </div>
                <div class="item-resume-cart">
                    <span style="font-weight: 300" class="name-item-cart"><?php echo Mage::getSingleton('core/session')->getDataCompra();?></span>
                    <span class="totalCompra"><strong><?php echo $total_formatado;?></strong></span>
                    <span class="totalCompra2" style="display: none;"><strong></strong></span>
                </div>
                <div class="resume-cart-totals">
                    <label>
                    <span style="font-weight: 300; text-align: center;font-size: 16px;color: #345a4c;font-family: 'CoHeadlineCorp-Light';">
                        Total: 
                    </span>
                    <span class="price onestep">
                    <?php echo $total_formatado;?>
                    </span>
                    <span class="price onestep2" style="display: none;"></span>
                    </label>
                    <div class="parcel">
                        2x de <?php echo $parcela;?>
                    </div>
                    <div class="parcel2" style="display: none;"></div>
                </div>
            </div>
          </div>
    
asked by anonymous 05.10.2017 / 22:41

1 answer

1

I found an answer to a similar question right here in Stackoverflow. The discussion on the subject can be found at:

link

And the demonstration of the operation together with the source code can be consulted at:

link

    
05.10.2017 / 22:58