PDA

View Full Version : DOCTYPE issue with 'Shake Image' Script



Dyomar
06-03-2010, 12:39 AM
1) Script Title: Shake Image Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/shake.htm

3) Describe problem: Hello! I have installed the 'shake image' script on a site of mine but it does not work when a DOCTYPE is included on the page. It works great without a DOCTYPE (the same as it works - also without DOCTYPE - on DD's page) but it seems that all DOCTYPES stop it from working (I am using Firefox and Safari). Is there a way to fix this issue? Maybe to modify the script so that it will work with a valid DOCTYPE? Thank you in advance!

ddadmin
06-03-2010, 07:53 AM
Ah yes. I've just updated the script to fix this issue: http://www.dynamicdrive.com/dynamicindex4/shake.htm :)

ozrob76
07-22-2010, 01:00 AM
Wondering if someone might help me with this aswell?
I am getting an error message when putting this into my 'Blogger' template- saying the element/type must immediately follow '&' and is not well parsed...? I pasted the code straight from yr page.
A novice at this stuff, so I'm wondering if there's something I'm missing/not adding, or not doing right?
Thx heaps- any help with this is appreciated, 'cos it's an awesome looking trick :)

ddadmin
07-22-2010, 08:04 AM
Ozrob76, please post a link to the page on your site that contains the problematic script so we can check it out.

ozrob76
07-24-2010, 06:48 AM
Thx heaps for your prompt reply :)
That's the thing, I'm not able to save the script into my page, because of the forementioned problem!
The problem is with the
if ((!document.all&&!document.getElementById)||stopit==1)
line apparently...
The error message reads
XML error message: The entity name must immediately follow the '&' in the entity reference.
I've done some looking around, & I think it may be an issue with browser compatibility? (I'm using IE8)

ozrob76
07-27-2010, 09:56 AM
Um, I'm guessing, now, this is a dumb question :D

ProNtylex
03-15-2011, 03:38 PM
hello, everybody.

i know the last post was 2010 and its 2011 now but i need help really bad figuring this out I'm not really good at the HTML codes so please bear with me :).

My Problem: i have a tumblr account and im trying to make my picture's shake on-mouse rollover. but every-time i enter the code it still doesn't work but i know it works because I've seen someone using the exact same theme, and hes profile looks just like mine just with the shaking of the pictures and the color of course.

between these two codes, i entered the <style> .shakeimage code

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> AND

<!--
'Heart In A Cage' theme for Tumblr by Fusels (c) 2010
http://fusels.tumblr.com
-->

At the very top of the HTML theme custom

<style>
.shakeimage{
position:relative
}
</style>
<script language="JavaScript1.2">

/*
Shake image script (onMouseover)-
Dynamic Drive (www.dynamicdrive.com)
For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

//configure shake degree (where larger # equals greater shake)
var rector=3

///////DONE EDITTING///////////
var stopit=0
var a=1

function init(which){
stopit=0
shake=which
shake.style.left=0
shake.style.top=0
}

function rattleimage(){
if ((!document.all&&!document.getElementById)||stopit==1)
return
if (a==1){
shake.style.top=parseInt(shake.style.top)+rector+"px"
}
else if (a==2){
shake.style.left=parseInt(shake.style.left)+rector+"px"
}
else if (a==3){
shake.style.top=parseInt(shake.style.top)-rector+"px"
}
else{
shake.style.left=parseInt(shake.style.left)-rector+"px"
}
if (a<4)
a++
else
a=1
setTimeout("rattleimage()",50)
}

function stoprattle(which){
stopit=1
which.style.left=0
which.style.top=0
}

</script>


then i paste this code

<img src="man.gif" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()">

right below it and it doesn't do anything at all, so can you please tell me what i am doing that is wrong?



i have how ever been fooling around with a random theme with image shake and when i paste this code in the theme below </script> at the top the images shake but the profile... everything is messed up and looks terrible Please can someone help me out, it would be very appreciated.

<div id="center">
{block:Posts}

{block:Photo}
<div class="other"><div style="text-align:right;"><div style="background-color: #F7F3F3; width:600px; -webkit-transition-duration: .5s; font-family: consolas;"><div id="perma"><div class="textp"><a href="{Permalink}"></a></div></div></div></div></center>
{LinkOpenTag}<meta name="{PhotoAlt}" content="{PhotoAlt}"/> <img src="{PhotoURL-400}" alt="{PhotoAlt}" border="0" width="500" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()> <div style="font-size: 10px;">
{block:Caption}
{Caption}
{/block:Caption}
{/block:Photo}
{block:Photoset}
{Photoset-600}
{block:Caption}
{Caption}
{/block:Caption}
{block:PostNotes}
{/block:PostNotes}
</div></div>
{/block:Photoset}


P.S. The profile i seen with the image shake, he has the same profile theme as me.

http://doperespect.tumblr.com/

ddadmin
03-16-2011, 03:30 AM
What's the URL to the problem page where the script doesn't work? I looked at http://fusels.tumblr.com but don't see the script installed.

ProNtylex
03-16-2011, 05:19 AM
hello, ddadmin

thank you for taking the time to answer me back. when you say URL i really don't fully know what that mean's i just hope you mean my profile page

http://lx-artizticthoughtsz-lx.tumblr.com/


And this page has the script installed on it http://doperespect.tumblr.com/ as you can see its just like my page just with the shake image script installed.

ddadmin
03-16-2011, 07:04 AM
Looking at your page, none of your images carry the required attributes needed to get that image to shake, for example:


<img src="man.gif" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()" />

Add the code in red to the desired images on your page.

ProNtylex
03-16-2011, 01:50 PM
i entered the code but why dose it look like that?

ddadmin
03-16-2011, 05:37 PM
Why does it look like what? Checking your page now the affected images do appear to shake.