我使用jQuery Autosize插件:
http://www.jacklmoore.com/autosize/
您可以在此处看到脚本本身:
http://www.jacklmoore.com/js/jquery.autosize.js
这是我使用脚本的方式:
jQuery(function($){$(document).ready(function(){
$('textarea').autosize();
}
Run Code Online (Sandbox Code Playgroud)
问题N 1
刚刚将脚本更新到最新版本并停止工作:
"TypeError: (intermediate value)(...) is not a function"
Run Code Online (Sandbox Code Playgroud)
Javascript控制台在脚本的最后一行报告此错误:
}(window.jQuery || window.$));
Run Code Online (Sandbox Code Playgroud)
问题N 2
脚本在模态窗口(PrettyPhoto)中不起作用,javascript控制台不显示任何错误.
有任何想法吗?
我网站的一些用户希望能够将 gif 图像上传到他们的个人资料中。我允许这样做,但是...一些 gif 文件非常大 - 1-2 MB 甚至更多,在单个页面上创建带有 20 x 1 MB gif 动画的画廊并不是一个好主意。如果我使用 ImageMagick 创建缩略图,缩略图也会被动画化,我会从 1 MB 文件中获得约 600 KB 的缩略图。太多了,缩略图处理需要很长时间。
有什么方法可以创建动画 gif 文件的静态缩略图,以便仅在用户单击缩略图时加载动画文件?
谢谢。
我花了一整天的时间来创建一个脚本,在"提交"中隐藏表单并显示隐藏的动画进度条.问题是Internet Explorer不会在隐藏的div中显示动画gif图像.图像是静态的.我访问了很多网站,发现了一个脚本,它使用:
document.getElementById(id).style.backgroundImage ='url(/images/load.gif)';
最后,我的脚本可以在Internet Explorer,Firefox,Opera中运行但是...... Google Chrome根本不显示图像.我只看到div文本.经过多次测试后,我发现了以下内容:在Google Chrome浏览器中查看背景图片的唯一方法是在页面中的某个位置(隐藏div之外)包含1px维度的相同图像:
<img src="/images/load.gif" width="1" heigh="1" />
Run Code Online (Sandbox Code Playgroud)
这样做了但是......在这个脏解决方案之后,Microsoft Explorer出于某种原因再次将图像显示为静态.所以,我的问题是:有什么方法可以强制Gogle Chrome显示图片吗?谢谢.这是我的脚本:
<script language="JavaScript" type="text/javascript">
function ver (id, elementId){
if (document.getElementById('espera').style.visibility == "visible") {
return false;
}else{
var esplit = document.forms[0]['userfile'].value.split(".");
ext = esplit[esplit.length-1];
if (document.forms[0]['userfile'].value == '') {
alert('Please select a file');
return false;
}else{
if ((ext.toLowerCase() == 'jpg')) {
document.getElementById(id).style.position = 'absolute';
document.getElementById(id).style.display = 'inline';
document.getElementById(id).style.visibility = "visible";
document.getElementById(id).style.backgroundImage = 'url(/images/load.gif)';
document.getElementById(id).style.height = "100px";
document.getElementById(id).style.backgroundColor = '#f3f3f3';
document.getElementById(id).style.backgroundRepeat = "no-repeat";
document.getElementById(id).style.backgroundPosition = "50% …Run Code Online (Sandbox Code Playgroud) $string = 'folder1:image1.jpg|folder2:image2.jpg|folder3:image3.jpg';
Run Code Online (Sandbox Code Playgroud)
我需要爆炸字符串以获得以下结果:
<img src="/folder1/image1.jpg" />
<img src="/folder2/image2.jpg" />
<img src="/folder3/image3.jpg" />
Run Code Online (Sandbox Code Playgroud)
一个分隔符不是问题,但我有两个分隔符,不知道怎么做:
$imagedata = explode("|", $string);
foreach($imagedata as $image) {
echo "$image<br />";
}
Run Code Online (Sandbox Code Playgroud)