YOOtheme Pro is here! The best WordPress and Joomla theme. Learn more

Avatar jj.spelman asked

Uikit Modal on page load not working

I am trying to get a modal to load when the page loads but I am getting nothing except a console error. I copied the code directly from the YooTheme pages/forums to no avail.

                <script>    
$(document).ready(function() {  
   $.UIkit.modal('#newsmodal').show();  
});  
</script>   

<!-- This is the modal -->    
<div id="newsmodal" class="uk-modal">    
    <div class="uk-modal-dialog">    
        <a class="uk-modal-close uk-close"></a>    
        <img src="images/notpetya-ransomware-noitice.jpg" alt="NotPetya RansomWare Screen Image" width="" height="" />    
        <h1>Breaking News</h1>  
        <h3>The RansomWare Virus "NotPetya" has Reached Thousands Globally and is Expected to Grow</h3>  
        <p><a class="uk-button uk-button-secondary" href="/notpetya-ransomware-removal.php" title="CryptoWall Ransomware Removal">Read More</a></p>  
    </div>    
</div> 

I keep getting this error:

TypeError: undefined is not an object (evaluating '$.UIkit.modal')

Any thoughts are greatly appreciated!

The page in question is here: http://www.ransomrescue.com/

  • General Question
  • UIkit

Edited

1 Answer

0

Avatar florian Yootheme answered

Try replacing $.UIkit.modal with UIkit.modal (without the leading $.). Does that work?

Know someone who can answer? Share a link to this question via email or twitter.