Short stay parking

Hi Blocheads.

I have a line of text I would like to appear on page load, and then disappear after a defined time, say 5 secs.
I guess a blinking action with the colours reversed maybe. Is that possible?

If it can, I’m sure you wonderful people will know :wink:

Thank you,
Andy

Bloc’s sites already have JQuery present, so just us that in conjunction with setTimeout() - as just one method to accomplish this. If you need help a simple Google search of your query yields plenty of examples of just that.

All sorted thanks. It took a bit of fiddling and working out, but I got there.

1- wrap the text in a

brick with an ID ( in my case called’ italic-div’).
2- add script below to in page settings.
3- Only works on preview in browser.

<script> //When the page has loaded. $( document ).ready(function(){ $('#italic-div').fadeIn('slow', function(){ $('#italic-div').delay(6000).fadeOut(); }); }); </script>.

BINGO

Hi.
Revisiting an old pic.
I have an italic div within a row, that I want to disappear after 6 seconds.
My code seems to no longer work and I done understand why.
I have this in the footer code area
Screenshot 2020-03-18 at 8.34.37 am

Added here


Any clues anyone?
Stay healthy,
Andy

Jquery is now loaded after the page HTML, you will need to adjust your code to execute using vanilla JS.

You could try using

document.addEventListener("DOMContentLoaded", function(){
  // Run Code Here
});

Into add code - footer?
OK Not in Header.
In footer doesn’t work either.
:thinking:

Give the ID what you have before “italic-div”

  1. Go to page settings

  2. Press Add Code

  3. Add this code:

<script> //When the page has loaded. 
document.addEventListener("DOMContentLoaded", function(){
	$('#italic-div').fadeIn('slow', function(){ 
		$('#italic-div').delay(6000).fadeOut(); 
	}); 
}); 
</script>

And voila…

By Jingo.
A cache clean didn’t work, but 30mm for the internet fairies to catch up and hey presto!
:+1:
Hi @Pealco
This looks close to the same code a grabbed a screenshot of above.
When added to the footer, it works in preview but not live on a site.
As @Norm states, jquery is added after the html, so this seems to fail.
I’ll add this later and report back.

Nope, nothing.
In the big scheme of things this isn’t a big problem tho.

Remember to turn off lazy loading, and yes is working.
What @norm explain is that before, you call the function with this code (your code):

$( document ).ready(function(){

And now as @Norm explain:

So your code/function have to be called/run with this code:

document.addEventListener("DOMContentLoaded", function(){

In the end I just update your code with @Norm instructions, and is working.

1 Like

All’s well now thanks.

Spoke too soon!
Fail again :-1:t2:

That may have something to do with the Typewriter snippet no longer working.
I deleted that as I couldn’t be bothered to try to sort it out.

What happened with typewriter?

I could no longer get it to reliably work

If you need help you need to be more specific.
And then I could try to help you.

Hi @Pealco
I tried again and remembered.
It was more of a case I couldn’t work out how to style it to match my H and paragraph styles, and colours.
Thanks,
Andy.

Maybe it isn’t SORTED. :thinking: