
02-06-2012, 01:20 AM
|
 |
|
|
Join Date: Dec 2001
Location: USA, New Jersey
Posts: 2,392
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by dartho
search headinclude template for
Code:
<script type="text/javascript">
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Cat Arriola | http://astrodiva.journalspace.com/ */
function fixImgs(maxW) {
var pix=document.getElementsByTagName('img');
for (i=0; i<pix.length; i++) {
w=pix[i].width;
h=pix[i].height;
if (w > maxW) {
f=1-((w - maxW) / w);
pix[i].width=w * f;
pix[i].height=h * f;
}
}
}
// Multiple onload function created by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
fixImgs(200); // ('element ID', maximum width)
});
</script>
and replace with :
Code:
<script type="text/javascript">
<!--
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Cat Arriola | http://astrodiva.journalspace.com/ */
function fixImgs(maxW) {
var pix=document.getElementsByTagName('img');
for (i=0; i<pix.length; i++) {
w=pix[i].width;
h=pix[i].height;
if (w > maxW) {
f=1-((w - maxW) / w);
pix[i].width=w * f;
pix[i].height=h * f;
}
}
}
// Multiple onload function created by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
fixImgs(200); // ('element ID', maximum width)
});
-->
</script>
this is an optimised version of the above code block you can use instead (optimised for size) I should probably move it to an external file so that browsers can cache it
Code:
<script type="text/javascript">
<!--
function addLoadEvent(a){var b=window.onload;if(typeof window.onload!="function"){window.onload=a}else{window.onload=function(){if(b){b()}a()}}}function fixImgs(a){var b=document.getElementsByTagName("img");for(i=0;i<b.length;i++){w=b[i].width;h=b[i].height;if(w>a){f=1-(w-a)/w;b[i].width=w*f;b[i].height=h*f}}}addLoadEvent(function(){fixImgs(200)})
-->
</script>
|
my headerinclude it
Code:
<vb:comment>
<meta name="viewport" content="width=320,user-scalable=yes,initial-scale=1.0" />
</vb:comment>
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<meta name="HandheldFriendly" content="true" />
<meta name="MobileOptimized" content="device-width" />
<meta http-equiv="Content-Type" content="text/html; charset={vb:stylevar charset}" />
<meta id="e_vb_meta_bburl" name="vb_meta_bburl" content="{vb:raw vboptions.bburl}" />
<vb:if condition="$show['threadinfo']">
<vb:elseif condition="$show['foruminfo']" />
<meta name="keywords" content="{vb:raw foruminfo.title_clean}, {vb:raw vboptions.keywords}" />
<meta name="description" content="<vb:if condition="$pagenumber > 1">{vb:rawphrase page_x, $pagenumber}-</vb:if>{vb:raw foruminfo.description_clean}" />
<vb:else />
<meta name="keywords" content="{vb:raw vboptions.keywords}" />
<meta name="description" content="{vb:raw vboptions.description}" />
</vb:if>
<link rel="stylesheet" href="{vb:raw vboptions.bburl}/lightweight.css.php" type="text/css" />
<base href="{vb:raw vboptions.bburl}/" />
|