Open popup automatically when navigate to the page id

What you can do is on document ready you can check your url and based on if #contact is there on not, show popup.

Something like:

jQuery(document).ready(function () {
    var type = window.location.hash.substr(1);
    if(type == 'contact'){
        //show popup
    }
}

Note: Check for syntax. Code not tested or tried.