开发者

jquery click simple modal plugin

i would like to pass a variable into my javascript, using simple modal plugin, http://w开发者_开发技巧ww.ericmmartin.com/projects/simplemodal/, .click function in my view (html) ... how this is my javascript:

$('#basic-modal .basic').click(function (e) {
    var src = "http://365.ericmmartin.com/"
    $.modal('<iframe src="' + src + '" height="450" width="830" style="border:0">', {
        closeHTML:"",
        containerCss:{
        backgroundColor:"#fff",
        borderColor:"#fff",
        height:450,
        padding:0,
        width:830
        },
        overlayClose:true
    });
        return false;
    });

and here is what i tried in my html:

%a.basic{:href => "#", :onclick => 'var src = "http://somesite.com/"'}


Jquery Dialog has this exact functionality already built for you. I would highly recommend you try out this approach:

http://jqueryui.com/demos/dialog/


Using $(this).attr("friendid") makes it work:

    $('#basic-modal .basic').click(function (e) {
$.modal('<iframe src="' + $(this).attr("friendid") + '" height="474" width="532" style="border:0;" scrolling="no">', {
    closeHTML:"",
    containerCss:{

    },
    overlayClose:true
});
    return false;

And in the HTML create an attribute called "friendid" or whatever you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜