PDA

View Full Version : Resolved Left-Right Stripy Curtain Problem



marain
04-21-2012, 11:27 PM
1) Script Title: Left-RIght Stripy Curtain

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex3/document3.htm


3) Describe problem: I adapted Left-Right Stripy Curtain code for xhtml. Adapted url page is:

http://www.marainlaw.com/page.php?here=test

It doesn't work. It loads fine, but the desired effect does not happen.

Suggestions invited.

A.

jscheuer1
04-22-2012, 07:14 AM
There could also be other problems, but this has to be fixed first and may be the only problem. Your copy of the script has become corrupted. Javascript operators like < and && have been replaced by their HTML entity counterparts like:

&lt;

and:

&amp;&amp;

Get a fresh copy of the script and this time use a text only editor like Notepad to paste it into your page's source code.

The browser cache may need to be cleared and/or the page refreshed to see changes.

marain
04-22-2012, 11:32 AM
jsheuer1, thank you.

The changes you suggested occurred to me last night as I was falling asleep!

I have now made those changes. Unhappily, the script still does not work.

A.

jscheuer1
04-22-2012, 04:09 PM
There are other problems. The script is outdated. Use this version -

Step 1:


<style type="text/css">

.intro{
position:absolute;
left:0;
top:0;
layer-background-color:blue;
background-color:blue;
border:0.1px solid blue;
z-index:10;
}

</style>

Step 2:


<div id="i1" class="intro"></div><div id="i2" class="intro"></div><div id="i3"
class="intro"></div><div id="i4" class="intro"></div><div id="i5" class="intro"></div><div
id="i6" class="intro"></div><div id="i7" class="intro"></div><div id="i8" class="intro"></div>
<script type="text/javascript">
/* <![CDATA[ */
/*
Left-Right Stripy Curtain Script- Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more free DHTML scripts, and TOS,
visit http://www.dynamicdrive.com
*/
(function(){

var ns4=document.layers?1:0
var ie4=document.all && !document.getElementById;
var ns6=document.getElementById//&&!document.all?1:0

var speed=20
var temp=new Array()
var temp2=new Array()
if (ns4){
for (i=1;i<=8;i++){
temp[i]=eval("document.i"+i+".clip")
temp2[i]=eval("document.i"+i)
temp[i].width=window.innerWidth
temp[i].height=window.innerHeight/8
temp2[i].top=(i-1)*temp[i].height
}
}
else if (ie4||ns6){
var clipright=window.innerWidth?window.innerWidth:document.documentElement.clientWidth
clipleft=0
for (i=1;i<=8;i++){
temp[i]=ns6?document.getElementById("i"+i).style:eval("document.all.i"+i+".style")
temp[i].width=(window.innerWidth?window.innerWidth-15:document.documentElement.clientWidth) + 'px'
temp[i].height=(window.innerHeight?window.innerHeight/8:document.documentElement.clientHeight/8) + 'px'
temp[i].top=(i-1)*parseInt(temp[i].height) + 'px'
}
}
function openit(){
window.scrollTo(0,0)
if (ns4){
for (i=1;i<=8;i=i+2)
temp[i].right-=speed
for (i=2;i<=8;i=i+2)
temp[i].left+=speed
if (temp[2].left>window.innerWidth)
clearInterval(stopit)
}
else if (ie4||ns6){
clipright-=speed
for (i=1;i<=8;i=i+2){
temp[i].clip="rect(0 "+clipright+"px auto 0)"
}
clipleft+=speed
for (i=2;i<=8;i=i+2){
temp[i].clip="rect(0 auto auto "+clipleft+"px)"
}
if (clipright<=0){
if (ns6){
for (i=1;i<=8;i++)
temp[i].display="none"
}
clearInterval(stopit)
}
}
}
function gogo(){
stopit=setInterval(openit,100)
}
gogo()
})();
/* ]]> */
</script>

marain
04-22-2012, 06:33 PM
My html coding is contained within a PHP page. Therefore I had to change some apostrophes in your updated script to quotation marks. I uploaded the updated script to the server. Now the PHP page doesn't load at all.

I then uploaded the entire PHP text page, if you care to look at it, at

http://www.marainlaw.com/includes/top.new.txt.

I note that right after the DD comment you provided a (function(){ statement without giving the function a name. I lack sufficient knowledge of javascript to say that it's wrong, but it appears strange. And even if it is wrong, from my limited knowledge of PHP, I don't know why it would prevent the page from loading.

Thank you for your patience.

A.

jscheuer1
04-22-2012, 07:37 PM
I don't see anything obvious. Um well $here first referenced in this section:


<title>New Jersey Criminal Defense Lawyer
<?php if ( $subhead[$here] ) echo ' - ' . $subhead[$here]; ?>
</title>

is not defined.

If I fix that and make it 'test':


<?php
header( 'Content-Type:text/html;charset=utf-8' );
$here = 'test';
/*******************************************************************************************
* Here are the subheads for each page. How to modify:
*
* must be within las . . .

and run the page as PHP, it loads fine and the script runs perfectly, so I don't think there's anything wrong with the script or the PHP code in that file.

Anyways, it's probably not the script itself, more likely something to do with the PHP code as it interacts with other PHP code, or maybe you just left out that part that GETs the $here value. The script also works on the page in a local mock up. I can put up a demo of that of you like.

That function without a name is an anonymous function, perfectly valid - look it up. In this particular case it isolates the script's variable and function names form the global scope. Since you were having problems with the script anyway, I thought that would be a good step as older scripts like this one often conflict with other scripts because they use so much of the global name space. I generally do that (as long as it doesn't break the script) whenever I update an old script like this.

I took your code for this script from your attached .txt file exactly as its supposed to be echoed by PHP and put it into my mock up and it worked fine.

Try putting up a demo of the page all messed up, perhaps that will give me a clue as to the solution. I might have a look at the current working top.inc.php - that might also shed some light on this. Attach that if you're still having problems.

marain
04-23-2012, 01:44 AM
John, I'm afraid I'm going to have to let this one go. I often have time to delve into this on weekends, but little time during the week. I maintain my sites, and try to add effects from time to time, but the effects portion of it is more a hobby than anything else. (The substance on the pages is a different story.)

By the time I have any time to look into this more deeply next week, I will have lost track of where we were. I'm afraid the intricacies of this are more trouble than the incremental value of the enhancement.

To address your most recent comments...

1. marainlaw.com/includes/top.new.txt has the current working top.inc.php;

2. $here is defined elsewhere;

3. marainlaw.com/page.php?here=test uses the top.inc.php that reflects the DD script. It loads OK. It merely does not produce the effect that we seek. Its loading suggests that the PHP code is not the problem. Recall that my substituting your suggested code causes the page not to load at all;

4. John, I have been trespassing grievously on your time. And while I am deeply appreciative, I cannot in good conscience continue to bother you for what is more a hobby than anything else.

A.

marain
04-23-2012, 06:32 PM
jscheuer1, I couldn't let it go. It now works! It wasn't loading because the replacement script contained apostrophes that PHP required that I change back to quotation marks.

I thought I saw a DD "resolved" button before to indicate problem solved, although I don't see it right now.

Thanks again.

A.

jscheuer1
04-23-2012, 08:00 PM
Great. You can mark a thread resolved by editing the first post in the thread and choosing the advanced editor. There will be a prefix selection in the upper left corner, choose 'Resolved'. I'll take care of this one though.