Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to make Fancy Box on your text portion

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 562
    Comment on it

    Hello reader! if you having the page and need to show the fancy loading on any text portion then you can see the code below.

    For the loader and the text the css will go like this

    #dummy {
        display: none;
    }
    
    #target {
        display:inline-block;
    }
    
    #overlay {
        display:none;
        position: absolute;
        background: rgba(0,0,0,.5);
    }
    
    .fancybox-inner iframe {
        display: block;
        width: 100%;
        height: 100%;
    }
    

    And the the HTML code for this is go like this as example

    <ul id="target">
        <li>
           1111111111111
        </li>
        <li>
           22222222222222
        </li>
        <li>
           33333333333333
        </li>
        <li>
           44444444444444
        </li>
        <li>
           555555555555555
        </li>
        <li>
           66666666666666
        </li>
    </ul>
    <div id="overlay"></div>
    <br>
    <br>    
    <div type="button" class="on">on </div>
    <div type="button" class="off">off </div>
    

    For the action on clicked on ON/OFF button you just need to write js code at the bottom of page.

    $(".on").click(function(){
        var target = $('#target');
        var overlay = $('#overlay');
        overlay.width(target.width()).height(target.height()).css({
            'left': target.position().left,
            'top': target.position().top
        }).fadeIn(200);
        $.fancybox.showLoading();
        $('#fancybox-loading').css({
            'left': (target.width() - $('#fancybox-loading').width()) / 2,
            'top': (target.height() - $('#fancybox-loading').height()) / 2,
            'margin': 0
        });
    });
    $(".off").click(function(){
        $('#overlay').fadeOut(200);
        $.fancybox.hideLoading();  
    });
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: