-1

我正在使用 CSS 样式display:block并基于以下条件none隐藏: If facebook has been blocked display else display 。divfb_Blockedwizardfb_wizard

当我加载或刷新页面时,div fb_Blockedwizard它会显示几秒钟然后div隐藏。

我需要div在页面加载或刷新期间隐藏

下面是我正在使用的代码:

<script>
  $(document).ready(function() {
    hideFbBlockedwizard();
    hidefbwizard();
    var callbackOnSuccess = function(src) {
      hideFbBlockedwizard();
      showwizard();
      return false;
    };
    var callbackOnFailure = function(src) {
      hidefbwizard();
      showFbBlockedwizard();
    };
    checkAvailability("http://www.facebook.com/favicon.ico", 
      callbackOnSuccess,callbackOnFailure);
  });

  function  showFbBlockedwizard() {
    document.getElementById('fb_Blockedwizard').style.display='block';
    document.getElementById('fade').style.display='block';
  }   

  function hideFbBlockedwizard() {  
    document.getElementById('fb_Blockedwizard').style.display='none';
    document.getElementById('fade').style.display='none';
  }

  function checkAvailability(src, callbackSuccess, callbackFailure) {
    $("<img/>").attr("src", src).load(function() {
      callbackSuccess(src);     
  }).error(function() {
    callbackFailure(src);
  });
}

function showwizard() {
  document.getElementById('fb_Blockedwizard').style.display='none';
  document.getElementById('fb_wizard').style.display='block';
  document.getElementById('fade').style.display='block';    
}

这是我的CSS:

.white_content {
        /*display: none;*/
        display:none;
        position: absolute;
        top: 25%;
        left: 25%;
        width: 46%;
        height: 37%;
        padding: 16px;
        border: 16px solid #999;
        background-color: white;
        z-index:1002;
        overflow: auto;
}
.white_content1 {
        display:none;
        position: absolute;
        top: 13%;
        left: 18%;
        width: 60%;
        height: 63%;
        padding: 16px;
        border: 16px solid #999;
        background-color: white;
        z-index:1002;
        overflow: auto;
}

这是我的PHP:

  <div id="fb_wizard" class="white_content">
  <?php include  'fb_blocked.php'; ?>
  </div>
  <div id="fb_Blockedwizard" class="white_content1">
         <?php include  'fb_blocked_email.php'; ?> </div>
4

1 回答 1

1

fb_Blockedwizard您布局的一部分吗?如果是这样,那么直接给它display:noneHTML/CSS 中的样式。将其设置为display:block每个 javascript。

于 2012-08-06T09:54:14.853 回答