$( document ).ready() construct

The jQuery ready() came to my attention when I was looking at a timed modal (pop-up).

The Document Ready Event is a jQuery event. It prevents the processing of enclosed code until the document has fully loaded. i.e. a modal cannot be closed until it has been created.

The syntax of the construct shown in the example below contains more jQuery Selectors and jQuery effects.

The jQuery selectors are by id - id="modal" and id="third"

The jQuery effects are "hide" and "show"

A full list od the selectors and effects can be found on the W3C website.

Top

The construct for the timed modal:

<script>
$(document).ready(function(){
  $('#modal').click(function(){
   $('#Third').modal('show');
    setTimeout(function() {$('#Third').modal('hide');},
     5000);
  });
});
</script>

This is a paragraph.

For some reason this has broken - the code seems to work on a new page - Here.

Links

Top

References:

  • 1 - Template literals (Template strings) - https:// developer.mozilla.org /en-US/docs/Web/ JavaScript/Reference/ Template_literals
  • 2 - Window setTimeout() - https:// www.w3schools.com/jsref/ met_win_settimeout.asp - this was used in my slideshow pages
  • 3 - $( document ).ready() - https://learn.jquery.com/using-jquery-core/document-ready/
  • 4 - jQuery Tutorial - https:// www.w3schools.com/ jquery/default.asp

Site design by Tempusfugit Web Design -