dosgy00204 2014-09-10 05:45
浏览 57
已采纳

如何在页面完全加载时运行php脚本

I am fetching tweets and showing them into the slider . now when i open the page it shows me all the tweets one above another which create a mess. and after page fully loaded it shows me tweets as i wanted . so is there any way to show tweets or run php code when page is fully loaded ?

  • 写回答

2条回答 默认 最新

  • douwei1921 2014-09-10 05:56
    关注

    It sounds like all your tweets are output via php, and then styled into a slider with javascript, so in between the data being output and the javascript loading, you see the unstyled data.

    A simple solution would be to give the containing element a style of display:none, then show it via javascript when the page has loaded:

    css

    #tweet-holder{
        display:none;
    }
    

    php / html

    <div id="tweet-holder">
        //all your tweets go here
    </div>
    

    js

    $(function(){
        $('#tweet-holder').show();
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部