[英]jquery click simple modal plugin
i would like to pass a variable into my javascript, using simple modal plugin, http://www.ericmmartin.com/projects/simplemodal/ , .click function in my view (html) ... how this is my javascript: 我想使用简单的模态插件http://www.ericmmartin.com/projects/simplemodal/在我的视图(html)中将.click函数传递给我的javascript,这是我的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: 这是我在HTML中尝试过的内容:
%a.basic{:href => "#", :onclick => 'var src = "http://somesite.com/"'}
Jquery Dialog has this exact functionality already built for you. jQuery Dialog已经为您构建了此确切功能。 I would highly recommend you try out this approach:
我强烈建议您尝试这种方法:
http://jqueryui.com/demos/dialog/ http://jqueryui.com/demos/dialog/
Using $(this).attr("friendid") makes it work: 使用$(this).attr(“ friendid”)可以使其工作:
$('#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. 然后在HTML中创建一个名为“ friendid”的属性或您想要的任何属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.