Как решить проблему с миганием? Когда обновляю страницу сайта или перехожу по ссылке из меню начинают мигать на доли секунды: Блоки, формы, таблицы, иконки, картинки, текст и.т.д... Это связано с js кодом когда его убираю то все нормально без миганий. на примере у меня есть файл php (bonus.php) и в нем сам php код, html, немного стилей, и сам проблематичный js код. Вот на пример с этим кодом мигает сайт.
<script type="text/javascript"> var timer_bonus_st=new Date().getTime().toString().substr(0,10); var timer_bonus_total='.($bonus_gift_time-($time-$mydm['bonus_gift_time'])).'; timer_bonus(); </script>
А вот сам код полностью (bonus.php)
<title>Ежедневный бонус - Speed-cars</title> <?php $bonus_gift_min=0; $bonus_gift_max=0; $bonus_gift_plan=''; foreach($bonus_gift_a as $v){ if($mydm['up_m']>=$v[0]){ $bonus_gift_min=$v[1]; $bonus_gift_max=$v[2]; } $bonus_gift_plan.='<tr><td>При пополнении от '.$v[0].' р. </td><td> и выше, бонус от '.number_format($v[1]/100,2,'.','').' до '.number_format($v[2]/100,2,'.','').' р.</td></tr>'; } echo ' <main> <div class="rows" style="margin-top: -27px; margin-bottom: -15px;"> <div class="status-bar"> <ul> <li class="progres" style="border-radius: 3px;"> <div class="icon"> <img src="/images/b2.png" style="width: 60px;"> <i style="font-size: inherit; font: normal normal normal 22px/1 FontAwesome; position: absolute; color: #81c851; margin: 30px 0px 0px -40px;" class="fa fa-gift"></i> </div> <div class="content" style="font-size: 16px; font-family: Oswald; font-weight: 500; color: #f9f9f9; text-align: center; margin-top: 18px;"> '.number_format($mydm['bonus_gift_r'], 2, '.', ' ').' <i class="fa fa-rub" style="color: #81c868; font-size: 18px;"></i></div> <p style="font-size: 15.5px; font-family: Oswald; color: #b5b0ab; text-align: center; margin-bottom: 10px;"> Доход с бонусов: <p> </li> <li class="progres" style="border-radius: 3px;"> <div class="icon"> <img src="/images/b2.png" style="width: 60px;"> <i style="font-size: inherit; font: normal normal normal 22px/1 FontAwesome; position: absolute; color: #ffbd41; margin: 30px 0px 0px -42px;" class="fa-bullhorn"></i> </div> <div class="content" style="font-size: 16px; font-family: Oswald; font-weight: 500; color: #f9f9f9; text-align: center; margin-top: 18px;"> '.number_format($mydm['serf_r'], 2, '.', ' ').' <i class="fa fa-rub" style="color: #81c868; font-size: 18px;"></i></div> <p style="font-size: 15.5px; font-family: Oswald; color: #b5b0ab; text-align: center; margin-bottom: 10px;"> Доход с сёрфинга: <p> </li> <li class="progres" style="border-radius: 3px;"> <div class="icon"> <img src="/images/b2.png" style="width: 60px;"> <i style="font-size: inherit; font: normal normal normal 20px/1 FontAwesome; position: absolute; color: #f05050; margin: 31px 0px 0px -42px;" class="fa fa-car"></i> </div> <div class="content" style="font-size: 16px; font-family: Oswald; font-weight: 500; color: #f9f9f9; text-align: center; margin-top: 18px;"> '.number_format($mydm['deps_r'], 2, '.', ' ').' <i class="fa fa-rub" style="color: #81c868; font-size: 18px;"></i></div> <p style="font-size: 15.5px; font-family: Oswald; color: #b5b0ab; text-align: center; margin-bottom: 10px;"> Доход с автопарка: <p> </li> <li class="progres" style="border-radius: 3px;"> <div class="icon"> <img src="/images/b2.png" style="width: 60px;"> <i style="font-size: inherit; font: normal normal normal 22px/1 FontAwesome; position: absolute; color: #70a4de; margin: 30px 0px 0px -42px;" class="fa-user-plus"></i> </div> <div class="content" style="font-size: 16px; font-family: Oswald; font-weight: 500; color: #f9f9f9; text-align: center; margin-top: 18px;"> '.number_format($mydm['refs_r_1']+$mydm['refs_r_2']+$mydm['refs_r_3'], 2, '.', ' ').' <i class="fa fa-rub" style="color: #81c868; font-size: 18px;"></i></div> <p style="font-size: 15.5px; font-family: Oswald; color: #b5b0ab; text-align: center; margin-bottom: 10px;"> Доход с рефералов: <p> </li> </li> </ul> </div> <!-- /ФОРМА РЕГИСТРАЦИИ --> <div class="box box-danger left" style="float: left; height: 100%; padding: 0px 0px 0px 0px; background: #18191c; margin-top: 10px; margin-bottom: 40px;"> <style> .wave{ border-top-right-radius: 5px; border-top-left-radius: 5px; height: auto; position: relative; } .wave::before{ content: ""; position: absolute; left: 0; bottom: 0; right: 0; background-repeat: repeat; height: 10px; background-size: 20px 20px; background-image: radial-gradient(circle at 10px -5px, transparent 12px, #18191c 13px); } .wave::after{ content: ""; position: absolute; left: 0; bottom: 0; right: 0; background-repeat: repeat; height: 15px; background-size: 40px 20px; background-image: radial-gradient(circle at 10px 15px, #18191c 12px, transparent 13px); } </style> <div class="wave"> <img src="/img/bonus.png" style=" width: 100%; margin-top: -5px; border-top-right-radius: 10px; border-top-left-radius: 10px;"> </div> <br>'; if(sizeof($bonus_gift_a)>1){ if($bonus_gift_bet_time==0){ $bonus_gift_bet_time=$time+10; } if($mydm['bets_time']+$bonus_gift_bet_time<$time && $mydm['balance']>=$bonus_gift_bet_sum){ $message='<b class="bonus_gift_message_bet">Для получения бонуса сделайте ставку</b>'; } if(empty($bonus_gift_time) || $bonus_gift_time<600){ echo 'bonus_gift data error'; exit; } if(!isset($_SESSION['a_time'])){ $_SESSION['a_time']=0; } if(!empty($_POST['a_time']) && $_SESSION['a_time']!=$_POST['a_time']){ $_POST['a_time']=preg_replace("#[^0-9]+#",'',$_POST['a_time']); $_SESSION['a_time']=0+substr($_POST['a_time'],0,20); if($bonus_gift_bet_time==0 || ($bonus_gift_bet_time>0 && $mydm['balance']<$bonus_gift_bet_sum)){ $bonus_gift_bet_time=$time+10; } if($mydm['bets_time']+$bonus_gift_bet_time>$time){ if($time-$mydm['bonus_gift_time']>$bonus_gift_time){ if($bonus_gift_g==1 || ($bonus_gift_g==2 && $mydm['soc']=='vkontakte') || ($bonus_gift_g==3 && $mydm['soc']=='vkontakte')){ $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,'https://api.vk.com/method/groups.isMember?v=5.0&group_id='.$vk_group_id.'&access_token='.$vk_at.'&user_id='.$mydm['sn_id']); curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0); curl_setopt($ch,CURLOPT_REFERER,$_SERVER['HTTP_HOST']); curl_setopt($ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $result=curl_exec($ch); curl_close($ch); $result=json_decode($result,true); } else{ $result['response']=1; } if($result['response']=='1'){ if($bonus_gift_g==3 && $mydm['soc']=='vkontakte'){ $bonus_gift_up_m=0; } if($mydm['up_m']<$bonus_gift_up_m){ $message='<b class="bonus_gift_message_up_m">Для получения бонуса пополните баланс с кошелька на '.$bonus_gift_up_m.' руб.</b>'; } else{ $bonus_gift_sum=rand($bonus_gift_min,rand($bonus_gift_min,$bonus_gift_max)); $bonus_gift_sum=number_format($bonus_gift_sum/100,2,'.',''); $mydm['bonus_gift_time']=$time; mysqli_query($db,"INSERT INTO bonus_gift (uid,login,avatar,soc_icons,sum,date,date_word) VALUES ('".$u_id."','".$mydm['login']."','".$mydm['avatar']."','".$mydm['soc_icons_13px']."','".$bonus_gift_sum."','$time','".date('d.m.y H:i:s',$time)."')") or die('cant insert bonus_gift'); $last_id=0+mysqli_insert_id($db); mysqli_query($db,"UPDATE users SET $bonus_gift_path=$bonus_gift_path+$bonus_gift_sum,bonus_gift_time=$time,bonus_gift_c=bonus_gift_c+1,bonus_gift_r=bonus_gift_r+$bonus_gift_sum WHERE uid=$u_id LIMIT 1") or die('cant update balance'); $bonus_gift_c=$last_id; mysqli_query($db,"UPDATE data SET bonus_gift_c=$bonus_gift_c,bonus_gift_r=bonus_gift_r+$bonus_gift_sum LIMIT 1") or die('cant update data'); if($bonus_gift_c>$bonus_gift_items){ mysqli_query($db,'DELETE FROM bonus_gift WHERE id<'.($bonus_gift_c-$bonus_gift_items+1)); mysqli_query($db,"OPTIMIZE TABLE bonus_gift") or die('cant optimize bonus_gift'); } $mydm[$bonus_gift_path]+=$bonus_gift_sum; $mydm[$bonus_gift_path]=number_format($mydm[$bonus_gift_path],4,'.',''); $message=" <script> $.toast({ heading: 'Успешно!', text: 'Бонус получен успешно, на сумму $bonus_gift_sum руб.', position: 'top-right', icon: 'success', textColor: 'white', hideAfter: 5000, stack: false }) </script>"; } } else{ $message='<b class="bonus_gift_message_link">Для получения бонуса подпишитесь на наш паблик - <a href="'.$vk_group_link.'" target="_blank">'.$vk_group_link.'</a></b>'; } } else{ $message='<b class="bonus_gift_message_got">Вы уже получали бонус за этот период!</b>'; } } } echo $message; if($time-$mydm['bonus_gift_time']>$bonus_gift_time){ $bonus_gift_button='style="display:block;"'; if($mobile==0 && $bonus_gift_click==1){ $bonus_gift_button='style="display:none;"'; echo '<b id="bonus_gift_message_banner" class="bonus_gift_message_banner" style="display:block;">Для получения бонуса кликните по баннеру</b>'; } echo ' <form id="form_bonus_gift" style="display:none;" method="POST"><input type="hidden" name="a_time" value="'.$time.'"></form> <center> <button type="submit" style="border-radius: 2px; line-height: 1px; height: 50px; width: 240px; margin-bottom: -10px; margin-top: 15px; background: #5bc0de; border: 1px solid #5bc0de; font-family: Oswald; letter-spacing: 1px; font-size: 18px; color: aliceblue;" onClick="document.getElementById(\'form_bonus_gift\').submit();"> <i class="fa fa-gift" style="font: normal normal normal 20px/1 FontAwesome; color: aliceblue;"></i> Получить бонус </button> </center> '; } else{ echo ' <div class="icos_bonus_24" id="timer_bonus_id"><span id="take" style="color: #f6f9f6;"></span></div> <script type="text/javascript"> var timer_bonus_st=new Date().getTime().toString().substr(0,10); var timer_bonus_total='.($bonus_gift_time-($time-$mydm['bonus_gift_time'])).'; timer_bonus(); </script> '; } } echo' <div class="box box-bubble" style="width: 100%; box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 0.07); background: #18191c; padding: 21px 15px 0px 15px; margin-top: 23px; margin-bottom: 20px;"> <div id="bg-success" class="panel-collapse collapse in"> <div class="portlet-body" style="background: #1b1d21; padding: 10px 15px 5px 15px; border-radius: 5px; background: #1d1f23b8; border-top: 2px solid #8989892e; border-bottom: 2px solid #8989892e;"> <center> <h3 style=" border-bottom: 1.5px solid #393d3f94; margin-bottom: 15px; color: #d44646; padding: 7px 0px 0px 0px; height: 40px; margin-top: -7px; font-size: 16px; font-family: Oswald; font-weight: 500;"> « Лимиты для бонусов » </h3> </center> <!-- /ЗАГОЛОВОК ФОРМЫ РЕГИСТРАЦИИ --> <center> <h3 style="color: #ffffff; width: 100%; padding: 7px 0px 0px 0px; border-radius: 3px; height: 40px; background: #d44646; letter-spacing: 0.2px; margin-top: 10px; margin-bottom: 20px; font-size: 14px; font-family: Oswald; font-weight: 400;"> Ваш бонусный лимит: от '.number_format($bonus_gift_min/100,2,'.','').' до '.number_format($bonus_gift_max/100,2,'.','').' </h3> </center>'; echo ' <h3 style="font-family: Oswald; font-size: 13px; font-weight: 400; letter-spacing: 0.8px; color: #f0f8ff7a;"><i class="ti-upload" style="font-size: 12px; color: #81c868;"></i> Пополнено от 0 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i><span class="pull-right"> 0.01 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i> / 0.10 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i></span></h3> <div class="progress m-b-30" style="margin-top: -5px; height: 8px;"> <div class="progress-bar progress-bar-success progress-animated wow animated" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 5%"> </div> </div> <h3 style="font-family: Oswald; font-size: 13px; font-weight: 400; letter-spacing: 0.8px; color: #f0f8ff7a;"><i class="ti-upload" style="font-size: 12px; color: #81c868;"></i> Пополнено от 50 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i><span class="pull-right"> 0.05 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i> / 0.25 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i></span></h3> <div class="progress m-b-30" style="margin-top: -5px; height: 8px;"> <div class="progress-bar progress-bar-success progress-animated wow animated" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 15%"> </div> </div> <h3 style="font-family: Oswald; font-size: 13px; font-weight: 400; letter-spacing: 0.8px; color: #f0f8ff7a;"><i class="ti-upload" style="font-size: 12px; color: #81c868;"></i> Пополнено от 100 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i><span class="pull-right"> 0.15 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i> / 0.50 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i></span></h3> <div class="progress m-b-30" style="margin-top: -5px; height: 8px;"> <div class="progress-bar progress-bar-success progress-animated wow animated" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 25%"> </div> </div> <h3 style="font-family: Oswald; font-size: 13px; font-weight: 400; letter-spacing: 0.8px; color: #f0f8ff7a;"><i class="ti-upload" style="font-size: 12px; color: #81c868;"></i> Пополнено от 500 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i><span class="pull-right"> 0.25 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i> / 0.75 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i></span></h3> <div class="progress m-b-30" style="margin-top: -5px; height: 8px;"> <div class="progress-bar progress-bar-success progress-animated wow animated" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 35%"> </div> </div> <h3 style="font-family: Oswald; font-size: 13px; font-weight: 400; letter-spacing: 0.8px; color: #f0f8ff7a;"><i class="ti-upload" style="font-size: 12px; color: #81c868;"></i> Пополнено от 1 000 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i><span class="pull-right"> 0.50 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i> / 1.25 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i></span></h3> <div class="progress m-b-30" style="margin-top: -5px; height: 8px;"> <div class="progress-bar progress-bar-success progress-animated wow animated" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 45%"> </div> </div> <h3 style="font-family: Oswald; font-size: 13px; font-weight: 400; letter-spacing: 0.8px; color: #f0f8ff7a;"><i class="ti-upload" style="font-size: 12px; color: #81c868;"></i> Пополнено от 5 000 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i><span class="pull-right"> 1.00 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i> / 2.50 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i></span></h3> <div class="progress m-b-30" style="margin-top: -5px; height: 8px;"> <div class="progress-bar progress-bar-success progress-animated wow animated" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 55%"> </div> </div> <h3 style="font-family: Oswald; font-size: 13px; font-weight: 400; letter-spacing: 0.8px; color: #f0f8ff7a;"><i class="ti-upload" style="font-size: 12px; color: #81c868;"></i> Пополнено от 10 000 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i><span class="pull-right"> 3.00 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i> / 5.00 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i></span></h3> <div class="progress m-b-30" style="margin-top: -5px; height: 8px;"> <div class="progress-bar progress-bar-success progress-animated wow animated" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 65%"> </div> </div> <h3 style="font-family: Oswald; font-size: 13px; font-weight: 400; letter-spacing: 0.8px; color: #f0f8ff7a;"><i class="ti-upload" style="font-size: 12px; color: #81c868;"></i> Пополнено от 50 000 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i><span class="pull-right"> 5.00 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i> / 10.00 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i></span></h3> <div class="progress m-b-30" style="margin-top: -5px; height: 8px;"> <div class="progress-bar progress-bar-success progress-animated wow animated" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 75%"> </div> </div> <h3 style="font-family: Oswald; font-size: 13px; font-weight: 400; letter-spacing: 0.8px; color: #f0f8ff7a;"><i class="ti-upload" style="font-size: 12px; color: #81c868;"></i> Пополнено от 100 000 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i><span class="pull-right"> 10.00 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i> / 20.00 <i class="fa fa-rub" style="color: #81c868; font-size: 13px;"></i></span></h3> <div class="progress m-b-30" style="margin-top: -5px; height: 8px;"> <div class="progress-bar progress-bar-success progress-animated wow animated" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 100%"> </div> </div> </div> </div> </div> </div>'; echo' <div class="box box-statistics right" style="padding: 0px 15px 15px 15px; background: #1c1d21; border-top: 2px solid #d44646; border-bottom: 2px solid #d44646; margin-top: 5px;"> <div class="box-header with-border"> <div class="box-title"></div> <div class="box-tools pull-right"></div> <div class="clearfix"></div></div> <div class="box box-project" style="width: 100%; height: auto; box-shadow: 0px 0px 10px 0px rgba(255, 255, 255, 0.07); background: #18191c; padding: 21px 15px 15px 15px; margin-top: 15px;"> <div class="box-header with-border"> <div class="box-title"></div> <center> <h3 class="style_sbor_title_avtopark" style="color: #70a4de;"><i class="ti-gift" style="font-size: 17px; padding: 5px;"></i> Последние 15 бонусов </h3> </center> </div> <div class="box-content"> <table style="min-width: 100%;"> <thead> <tr> <th style="font-size: 14px; font-family: Oswald; font-weight: 500; color: #bdbdbd; letter-spacing: 0.7px; padding: 10px;">Пользователь:</th> <th style="font-size: 14px; font-family: Oswald; font-weight: 500; color: #bdbdbd; letter-spacing: 0.7px; padding: 0px 0px 0px 10px;">Сумма:</th> <th style="font-size: 14px; font-family: Oswald; font-weight: 500; color: #bdbdbd; letter-spacing: 0.7px; padding: 0px 0px 0px 10px;">Дата:</th> </tr> </thead>'; $row_tr_n=0; $s_q=mysqli_query($db,"SELECT * FROM bonus_gift ORDER BY id DESC LIMIT ".$bonus_gift_items) or die('cant select last bonus_gift'); while($s_m=mysqli_fetch_assoc($s_q)){ if($row_tr_n==1){ $row_tr_n=0; } else { $row_tr_n++; } $p_url=md5($s_m['uid'].$p_hash); $p_url=$s_m['uid'].'_'.substr($p_url,0,4); echo'<tbody style="border-top: 1px solid #26272b;">'; if($u_id==$admin_uid){ echo '<td class="style_sbor_tabl_avtopark" style="padding: 10px;"><a target="_blank" href="/profile/'.$p_url.'"> <img src="'.$s_m['avatar'].'" style="border-radius: 100%; width: 42px; height: 42px; border: 2.9px solid #3f424a;"> <b style="font-size: 14px; font-family: Oswald; font-weight: 400; color: #bdbdbd; letter-spacing: 0.7px; padding: 0px 0px 0px 10px;">'.$s_m['login'].'</b></a> '.$s_m['soc_icons'].'</td>'; } else{ echo '<td class="style_sbor_tabl_avtopark" style"padding: 10px;"> <img src="'.$s_m['avatar'].'" style="border-radius: 100%; width: 42px; height: 42px; border: 2.9px solid #3f424a;"> <b style="font-size: 14px; font-family: Oswald; font-weight: 400; color: #bdbdbd; letter-spacing: 0.7px; padding: 0px 0px 0px 10px;">'.$s_m['login'].'</b> '.$s_m['soc_icons'].'</td>'; } echo '<td class="style_sbor_tabl_avtopark" style="color: #74c868; font-size: 13px;"> <i style="font-size: 14px; color: #74c868;" class="ti-gift"></i> '.number_format($s_m['sum'], 2, '.', ' ').' <i class="fa fa-rub" style="color: #74c868; font-size: 14px;"></i></td> <td class="style_sbor_tabl_avtopark"><i class="fa fa-clock-o" style="font: normal normal normal 15px/1 FontAwesome;"></i> '.$s_m['date_word'].'</td> </tr>'; } echo' </tbody> </table> </div></div></div> </main>'; ?>
Помогите решить данную проблему!
Ответы (1)