පොඩි jquery/js coding උදව්වක් ඕනේ

radiax

Well-known member
  • Dec 9, 2007
    8,679
    985
    113
    සුන්දර හදවතක..-NRJ-
    පොඩි jquery/js coding උදව්වක් ඕනේ

    මචන් මට මෙන්න මේ ලින්ක් (http://www.trustmango.com/starting-a-business/) එකේ තියෙනවා වගේ පහලට scroll කරනකොට මතුවෙන top bar එකක් හදන්න ඕනේ.දන්න කෙනෙක් ඉන්නව නම් කොහොමද කියන්නකෝ. නෙට් එකෙත් හෙව්වා ඒත් හම්බ උනේ නෑ.

    2rc6e03.jpg

     

    Dileepa_J

    Active member
  • thats not what i want macho :(

    mehemai, when you go to the page you dont see this bar anywhere.but when you scrolling down the page it will appear. thats what i want :D

    Machan.. you have to think smart here.. :)

    Use the 1st link...

    style your bar [set width & height etc.]

    <div style="height:1000px;width:500px;">

    <div id="floatbar" style="background:gray;
    width:450px;
    height:40px;
    position:absolute;
    left:0;top:0px;">
    </div>
    </div>

    Then.. [#floatbar is your bar]
    'n' is scroll's y possision (points from top)...
    change the 'n' as your adjustments

    $(window).scroll(function(){
    if ($(window).scrollTop() <= n)
    {
    //set #floatbar visible = false
    }
    else
    {
    //set #floatbar visible = true
    }
    });
     
    Last edited:

    H@suri

    Member
    Sep 17, 2006
    2,518
    349
    0
    වියට්නාමයේ
    CSS Part

    /******************
    .topWrapper {
    background: none repeat scroll 0 0 hsl(0, 0%, 95%);
    height: auto;
    overflow: hidden;
    padding: 10px 0;
    position: fixed;
    width: 100%;
    z-index: 500;
    }
    /******************

    section class="topWrapper" style="opacity: 1; display: block;"
     
    Apr 30, 2012
    583
    40
    0
    ubata one eka meken karanna puluwan

    $(window).scroll(function() {
    var position = $(window).scrollTop();
    if (position > 600) {}});

    *mulin div ekak dala display none karapan

    css eka awilla position:fixed;
    ada podak busy nathnam ubata code eka liyala denawa
    mona hari tiboth msg ekak dapan !