2 Attachment(s)
Scroll to top script mess up everything else?
Hi all!
I�m not a newbie to WD since i used it for a couple of years but this problem i can�t solve by myself.
I�m doing a new site and on the firstpage i have the Slideshow, Cycle 4, which is really nice. But when i putting in the script from www.scrolltotop.com to have a animated "scroll to top" function it messes up the slide show. The slideshow repeats all the images all over the page??
I�ll think that there is a "collision" somewhere in the scripts/code but i haven�t the skills to solve that?
I have put the "Scroll to top" code in a placeholder within the site and the "icon" shows and is fully functional but the slideshow are showing all the images, repeating them from top to bottom?
Attachment 95806 Attachment 95807
Hopefully you understand what i mean when you look att the images.
Thanks! Kalle
Re: Scroll to top script mess up everything else?
Forget about it. That's a bad solution. Here's a simpler alternative. Put following code to the page head code section:
Code:
<script type="text/javascript">
function my_scr2top()
{
var x=window.pageXOffset;
var y=window.pageYOffset;
if(xr_ie)
{
x=document.documentElement.scrollLeft;
y=document.documentElement.scrollTop;
};
window.scrollTo(x/2,y/2);
if(x+y>4) setTimeout("my_scr2top()",50);
};
</script>
Then add following link to the button to start scrolling:
Code:
javascript:my_scr2top()
Re: Scroll to top script mess up everything else?
I haven't time to experiment but I imagine the Slideshow is using a jQuery instance placed there by Xara.
You are also calling a second jQuery library
Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
for your button.
I would remove this one line and see if that works.
It's not a good idea to rely on too many web calls to resources you don't have control over. I would search for a simple JavaScript function and embed that instead.
Acorn
Re: Scroll to top script mess up everything else?
Re: Scroll to top script mess up everything else?
Actually the solution that Steve posted works very well, it was written by Covoxer a Xara developer. You can see a working example on my Good Morning Sunshine website if you click the link in my signature :)
Re: Scroll to top script mess up everything else?
No problem with Covoxer's solution, just it scrolls to page top.
My approach scrolls to any anchor, up or down and the delay is altered in the Link not the code so you can flood your page with the ability to scroll up or down.
Horses for courses.
Acorn
Re: Scroll to top script mess up everything else?
Acorns example is far more versatile, it allows for scrolling up and down the page to whatever required anchor with variable animation speeds, not just resrolling to the top of the page.
Re: Scroll to top script mess up everything else?
So much choice, I have to admit that acorn's posted solution is very handy, both the ability to scroll at a preferred rate and the ability to scroll all over the place. Nice