问题描述
我已经从事了大约10个小时的研究,并且比开始时我更不喜欢这种方法. http://www.ericmmartin.com/projects/simplemodal 上的示例似乎都没有解决用我熟悉的术语和HTML代码完成此任务.我的测试页位于: http://chesstao.com/test.php
I have been working on the this for about ten hours and I am no closer to grokking the method than when I started. None of the examples at http://www.ericmmartin.com/projects/simplemodal seem to address this task in terms and HTML code that I am familiar with. My test page is at: http://chesstao.com/test.php
我认为我已按照说明进行了尝试:
I think I followed the instructions and tried:
<!DOCTYPE html> <html lang="en">
<head><title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../css/demo.css" rel="stylesheet" />
<link href="../css/basic.css" rel="stylesheet" />
<link href="../css/gallery.css" rel="stylesheet" />
</head><body>
<div><a href="images/aveskulov-large.jpg" id="sample">
click me </a></div>
<!--jQuery-->
<script src="http://code.jquery.com/jquery-latest.pack.js"></script>
<script src="js/jquery.simplemodal-1.4.1-min.js"></script>
<script src="js/basic-min.js"></script>
<script src="js/gallery-min.js"></script>
<script>$("#sample").modal({opacity:80,overlayCss: {backgroundColor:"#fff"}});</script>
</body></html>
但是结果很差.我真的很想知道我缺少什么简单的解决方案!
But the results were bad. I'd really like to know what simple solution am I missing!
推荐答案
如果您的问题是在新窗口中打开图像,则可能是因为click me具有href.它将不会加载任何其他代码直接到href.尝试将图像制作成html img标签,将其设置为不显示,然后单击某些元素进行模态设置,并将显示设置为block.
If your problem is that the image opening in a new window it is probably because the click me has an href.It won't load any other code just go straight to the href. Try making your image into an html img tag, set that to display none then on the click of some element do the modal and set the display to block.
我不知道您页面的最新版本是否是您尝试的版本,但是是否有很多错误阻止了它的正常运行.但是,这满足了您的需求.我敢肯定,您可以解决此问题,并按照自己的意愿进行操作,但这就是我为使其正常工作所做的
I don't know if the last version of your page was what you tried but if it was there was more than a few bugs that was preventing it from working. But this gets what you want. I am sure you can work off of this to get it to do and look how you want but this is what I did to get it to work
$(document).ready(function() {
$("#sample").click(function(){
$.modal("<img src=\"test.php_files/aveskulov-large.jpg\" style=\"\"/>");
});
});
此外,如果您执行此操作,则需要取出img html标签,使其仅存在于此模式中.祝你好运. P.S.如果您没有萤火虫,请使用它的firefox插件,它会告诉您语法错误.
Also if you do this you need to take out the img html tag so that it only exists in this modal. Goodluck with the rest. P.S. if you don't have firebug get it, its a firefox plugin and it would have told you you had a syntax error.
这篇关于simplemodal单击以显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!