Display block does not work in Safari

Asked

Viewed 132 times

1

I’m trying to change the css of a javascript loading.

The element is as display:none and when I submit I change this element to display:block and the same appears on the screen.

The point is that when tested on Mac Safari it just doesn’t work, I’ve tried changing the class, among other attempts, but it doesn’t work.

Someone’s been through it?

Follows the excerpt from the code in question: https://jsfiddle.net/pauloflesch/xpvt214o/24323/

Thanks in advance.

  • This shouldn’t happen there. Put your code in the question so we can evaluate it better, please. If possible create a Fiddle or a Stacksnippet.

  • Without code it becomes impossible to know the problem.

  • @Phiter edited the question and added the code.

  • Ever tried to replace position:fixed for position:absolute to see if it works?

  • @hugocsl tested and did not work.

1 answer

0

Use the methods below:

classList.add() and classList.remove();

Example:

$('#cadastro_pedido').click(function(){
		//document.getElementById('loading').setAttribute( "class", "loadingShow" );
		document.getElementById('loading').classList.add("loadingShow");
		document.getElementById('loading').classList.remove("loading");
		//document.getElementById('loading').style.display = 'block';
		var contador = 10;
		setInterval(function(){
			if(contador < 90){
				document.getElementById('testePaulo').innerHTML= contador + '%';
				contador += Math.floor((Math.random() * 10) + 1);
			}
		},1000);
		//document.getElementById("formProj").submit();
	});
.loading{
			position: fixed;
			z-index: 99;
			background: rgba(255,255,255,0.6);
			width: 100%;
			height: 100%;
			display: none;
		}
			.loadingShow{
			position: fixed;
			z-index: 99;
			background: rgba(255,255,255,0.6);
			width: 100%;
			height: 100%;
			display: block !important;
		}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="loading" class="loading">
		<div style="color:#5fbbfb;font-size: 70px;width: 100%;text-align: center;float: left;position: fixed;top:35%;" id="testePaulo"></div>
	</div>
	<a href="#" class="btn btn-success" disabled="disabled" id="cadastro_pedido" >Cadastrar Pedido</a>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.