Hello,
I'm new to jquery and jqmodal. I have a script that runs fine except
when the URL (href) of the anchor tag is Blank or "#". so what I want
to do is check for that possibility and stop the Jqmodal from acting
or put up an error message, without my page being messed up. I've
tried to use callbacks, but get an error that the hash is not defined.
I tried to use the click event of the anchor, but the Jqmodal would
load the content but only show it after clicking another anchor tag or
clicking the same one again. the goal here is to have a default pop Up
jqmodal that checks the link it is given and doesn't use it if it will
cause an error.

~~ code that works but doesn't check href of anchor~~
$(function(){
/* init pop-up/overlay */
    popUp.init();
});
/* pop-up/overlay Functionality */
var popUp = {
    init: function(){
        var link = $("a.popup");
        if(link.length <= 0)
            return false;
        popUp.createDiv();

        $('div#popup-wraper').jqm({
           trigger: $("a.popup"),
           closeClass: 'close',
           toTop: true,
           ajax: '@href',
           target: $("div#popup-wraper div#popup"),
           ajaxText: ("loading..."),
           cache: false
        })
    },
    createDiv: function(){
        var strJq = "<div id='popup-wraper' class='jqmWindow'>";
        strJq += " <div id='overlay-utility'>";
        strJq += "  <a class='close' href='#'>Close</a>";
        strJq += " </div>";
        strJq += " <div id='popup'>";
        strJq += " </div>";
        strJq += "</div>";
        $("body").append(strJq);
    }

}

/* pop-up/overlay Functionality END */
~~ end code ~~

Reply via email to