Javascript help :c - Hotmailkukac - May 25, 2010
Ye, I know I have a lots of problems, but when I finish my site, I will stop asking questions ✌
So help me please with this javascript. So, I found this javascript, which is I think very useful, but I have 1 problem with that:
It's scrolling to the section what you href, but it is scrolling the whole page.
Well, I need to use this script to scroll to the data In layer(which is has a scrollbar, thats why I need it :) )
So, is it possible to change the javascript somehow to make it work?
If yes, help me please :) 😊
Here is the script
PHP Code
<?php var bookmarkscroll={ setting: {duration:1000, yoffset:0}, //{duration_of_scroll_milliseconds, offset_from_target_element_to_rest} topkeyword: '#top', //keyword used in your anchors and scrollTo() to cause script to scroll page to very top
scrollTo:function(dest, options, hash){ var $=jQuery, options=options || {} var $dest=(typeof dest=="string" && dest.length>0)? (dest==this.topkeyword? 0 : $('#'+dest)) : (dest)? $(dest) : [] //get element based on id, topkeyword, or dom ref if ($dest===0 || $dest.length==1 && (!options.autorun || options.autorun && Math.abs($dest.offset().top+(options.yoffset||this.setting.yoffset)-$(window).scrollTop())>5)){ this.$body.animate({scrollTop: ($dest===0)? 0 : $dest.offset().top+(options.yoffset||this.setting.yoffset)}, (options.duration||this.setting.duration), function(){ if ($dest!==0 && hash) location.hash=hash }) } },
urlparamselect:function(){ var param=window.location.search.match(/scrollto=[\w\-_,]+/i) //search for scrollto=divid return (param)? param[0].split('=')[1] : null }, init:function(){ jQuery(document).ready(function($){ var mainobj=bookmarkscroll mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body') var urlselectid=mainobj.urlparamselect() //get div of page.htm?scrollto=divid if (urlselectid) //if id defined setTimeout(function(){mainobj.scrollTo(document.getElementById(urlselectid) || $('a[name='+urlselectid+']:eq(0)').get(0), {autorun:true})}, 100) $('a[href^="#"]').each(function(){ //loop through links with "#" prefix var hashvalue=this.getAttribute('href').match(/#\w+$/i) //filter links at least 1 character following "#" prefix hashvalue=(hashvalue)? hashvalue[0].substring(1) : null //strip "#" from hashvalue if (this.hash.length>1){ //if hash value is more than just "#" var $bookmark=$('a[name='+this.hash.substr(1)+']:eq(0)') if ($bookmark.length==1 || this.hash==mainobj.topkeyword){ //if HTML anchor with given ID exists or href==topkeyword if ($bookmark.length==1 && !document.all) //non IE, or IE7+ $bookmark.html('.').css({position:'absolute', fontSize:1, visibility:'hidden'}) $(this).click(function(e){ mainobj.scrollTo((this.hash==mainobj.topkeyword)? mainobj.topkeyword : $bookmark.get(0), {}, this.hash) e.preventDefault() }) } } }) }) } }
bookmarkscroll.init()
If you can help, please help, I really need it 🤩
Thanks,
Hotmailkukac 🤝
* - mastrmind - May 25, 2010
(May 25, 2010 03:50 AM)Hotmailkukac Wrote: Ye, I know I have a lots of problems, but when I finish my site, I will stop asking questions ✌
So help me please with this javascript. So, I found this javascript, which is I think very useful, but I have 1 problem with that:
It's scrolling to the section what you href, but it is scrolling the whole page.
Well, I need to use this script to scroll to the data In layer(which is has a scrollbar, thats why I need it :) )
So, is it possible to change the javascript somehow to make it work?
If yes, help me please :) 😊
Here is the script
PHP Code
<?php var bookmarkscroll={ setting: {duration:1000, yoffset:0}, //{duration_of_scroll_milliseconds, offset_from_target_element_to_rest} topkeyword: '#top', //keyword used in your anchors and scrollTo() to cause script to scroll page to very top
scrollTo:function(dest, options, hash){ var $=jQuery, options=options || {} var $dest=(typeof dest=="string" && dest.length>0)? (dest==this.topkeyword? 0 : $('#'+dest)) : (dest)? $(dest) : [] //get element based on id, topkeyword, or dom ref if ($dest===0 || $dest.length==1 && (!options.autorun || options.autorun && Math.abs($dest.offset().top+(options.yoffset||this.setting.yoffset)-$(window).scrollTop())>5)){ this.$body.animate({scrollTop: ($dest===0)? 0 : $dest.offset().top+(options.yoffset||this.setting.yoffset)}, (options.duration||this.setting.duration), function(){ if ($dest!==0 && hash) location.hash=hash }) } },
urlparamselect:function(){ var param=window.location.search.match(/scrollto=[\w\-_,]+/i) //search for scrollto=divid return (param)? param[0].split('=')[1] : null }, init:function(){ jQuery(document).ready(function($){ var mainobj=bookmarkscroll mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body') var urlselectid=mainobj.urlparamselect() //get div of page.htm?scrollto=divid if (urlselectid) //if id defined setTimeout(function(){mainobj.scrollTo(document.getElementById(urlselectid) || $('a[name='+urlselectid+']:eq(0)').get(0), {autorun:true})}, 100) $('a[href^="#"]').each(function(){ //loop through links with "#" prefix var hashvalue=this.getAttribute('href').match(/#\w+$/i) //filter links at least 1 character following "#" prefix hashvalue=(hashvalue)? hashvalue[0].substring(1) : null //strip "#" from hashvalue if (this.hash.length>1){ //if hash value is more than just "#" var $bookmark=$('a[name='+this.hash.substr(1)+']:eq(0)') if ($bookmark.length==1 || this.hash==mainobj.topkeyword){ //if HTML anchor with given ID exists or href==topkeyword if ($bookmark.length==1 && !document.all) //non IE, or IE7+ $bookmark.html('.').css({position:'absolute', fontSize:1, visibility:'hidden'}) $(this).click(function(e){ mainobj.scrollTo((this.hash==mainobj.topkeyword)? mainobj.topkeyword : $bookmark.get(0), {}, this.hash) e.preventDefault() }) } } }) }) } }
bookmarkscroll.init()
If you can help, please help, I really need it 🤩
Thanks,
Hotmailkukac 🤝
I think you are asking for some script ,which will scroll to a specific location in page ,when we click on some anchor tag.
If thats what you want you can use
Code <a href="#middle">scroll</a>
When someone clicks this "scroll" then he/she will be taken to the location of page where this div is
Code <div id="middle">hi</div>
* - Xon - May 25, 2010
Do you want the scroll automated?
* - Hotmailkukac - May 26, 2010
(May 25, 2010 08:07 PM)mastrmind Wrote: I think you are asking for some script ,which will scroll to a specific location in page ,when we click on some anchor tag.
If thats what you want you can use
Code <a href="#middle">scroll</a>
When someone clicks this "scroll" then he/she will be taken to the location of page where this div is
Code <div id="middle">hi</div>
The whole script is about that :D
But I don't need to scroll in the whole page, I need that scrip to scroll in the Layer, what has fixed height, but the data in that is much longer, so there is a scrollbar.
So I want to scrolll in that layer :P
(May 25, 2010 08:32 PM)Xon Wrote: Do you want the scroll automated? No, I want to scroll if they click :P
Thanks :)
Hotmailkukac
* - mastrmind - May 26, 2010
(May 26, 2010 01:21 AM)Hotmailkukac Wrote: The whole script is about that :D
But I don't need to scroll in the whole page, I need that scrip to scroll in the Layer, what has fixed height, but the data in that is much longer, so there is a scrollbar.
So I want to scrolll in that layer :P
(May 25, 2010 08:32 PM)Xon Wrote: Do you want the scroll automated? No, I want to scroll if they click :P
Thanks :)
Hotmailkukac
Just play around with this you will get what you want.
Code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
[b]<!--[/b]
#Layer1 {
position:absolute;
width:337px;
height:108px;
z-index:1;
left: 255px;
top: 750px;
overflow:scroll;
}
-->
</style>
</head>
<body>
<div id="middle"></div>
<a href="#last">click here</a>
<br /><br />
<div id="Layer1">
<br /><br />
<a href="#last">click here</a>
<br /><br />
So help me please with this javascript. So, I found this javascript, which is I think very useful, but I have 1 problem with that:
It's scrolling to the section what you href, but it is scrolling the whole page.
Well, I need to use this script to scroll to the data In layer(which is has a scrollbar, thats why I need it :) )Ye, I know I have a lots of problems, but when I finish my site, I will stop asking questions Victoire
So help me please with this javascript. So, I found this javascript, which is I think very useful, but I have 1 problem with that:
It's scrolling to the section what you href, but it is scrolling the whole page.
Well, I need to use this script to scroll to the data In layer(which is has a scrollbar, thats why I need it :) )Ye, I know I have a lots of problems, but when I finish my site, I will stop asking questions Victoire
So help me please with this javascript. So, I found this javascript, which is I think very useful, but I have 1 problem with that:
It's scrolling to the section what you href, but it is scrolling the whole page.
Well, I need to use this script to scroll to the data In layer(which is has a scrollbar, thats why I need it :) )Ye, I know I have a lots of problems, but when I finish my site, I will stop asking questions Victoire
So help me please with this javascript. So, I found this javascript, which is I think very useful, but I have 1 problem with that:
It's scrolling to the section what you href, but it is scrolling the whole page.
Well, I need to use this script to scroll to the data In layer(which is has a scrollbar, thats why I need it :) )Ye, I know I have a lots of problems, but when I finish my site, I will stop asking questions Victoire
<div id="last"></div>
</div>
So help me please with this javascript. So, I found this javascript, which is I think very useful, but I have 1 problem with that:
It's scrolling to the section what you href, but it is scrolling the whole page.
Well, I need to use this script to scroll to the data In layer(which is has a scrollbar, thats why I need it :) )Ye, I know I have a lots of problems, but when I finish my site, I will stop asking questions Victoire
So help me please with this javascript. So, I found this javascript, which is I think very useful, but I have 1 problem with that:
It's scrolling to the section what you href, but it is scrolling the whole page.
Well, I need to use this script to scroll to the data In layer(which is has a scrollbar, thats why I need it :) )Ye, I know I have a lots of problems, but when I finish my site, I will stop asking questions Victoire
So, is it possible to change the javascript somehow to make it work?
If yes, help me please :) Blush
Hey guy's. First of all I'm posting this because hackforums sometimes has good advice on things to buy. So here it is.
I'm getting a summer job of course in the summer, it's a full time job as a landscaper I get like $11 or $12 per hour (cheap but I'm only 15 + first job).
I'm turning 16 in the summer as well so yeah.
But the thing's I have in mind when I get this money is
* Laptop
* New Computer Desk
* New Computer Chair
* T.v wallmount :) (40 inch)
* Xbox 360 (Last one got banned)
* 1-2 Computer monitors.
I recently bought a gaming computer, so I'm only spending $700-$800 on a laptop. I'm also considering to buy a really nice home theatre system with really nice base, but thats a maybe still.
Is there anything else that's nice these day's that is a must buy?
I'm not going to be converting to paypal for hackforum's but the money I have on my paypal might go towards leet/ubers & rich bitch award.
<div id="top">
Anything cool, doesn't matter price that is cool to have?
Suggest anything , any price and if a link is possible that would be great , hopefully I get good feedback on this.
Hey guy's. First of all I'm posting this because hackforums sometimes has good advice on things to buy. So here it is.
I'm getting a summer job of course in the summer, it's a full time job as a landscaper I get like $11 or $12 per hour (cheap but I'm only 15 + first job).
I'm turning 16 in the summer as well so yeah.
But the thing's I have in mind when I get this money is
* Laptop
* New Computer Desk
* New Computer Chair
* T.v wallmount :) (40 inch)
* Xbox 360 (Last one got banned)
* 1-2 Computer monitors.
I recently bought a gaming computer, so I'm only spending $700-$800 on a laptop. I'm also considering to buy a really nice home theatre system with really nice base, but thats a maybe still.
Is there anything else that's nice these day's that is a must buy?
I'm not going to be converting to paypal for hackforum's but the money I have on my paypal might go towards leet/ubers & rich bitch award.
Anything cool, doesn't matter price that is cool to have?
Suggest anything , any price and if a link is possible that would be great , hopefully I get good feedback on this.
Hey guy's. First of all I'm posting this because hackforums sometimes has good advice on things to buy. So here it is.
I'm getting a summer job of course in the summer, it's a full time job as a landscaper I get like $11 or $12 per hour (cheap but I'm only 15 + first job).
I'm turning 16 in the summer as well so yeah.
But the thing's I have in mind when I get this money is
* Laptop
* New Computer Desk
* New Computer Chair
* T.v wallmount :) (40 inch)
* Xbox 360 (Last one got banned)
* 1-2 Computer monitors.
I recently bought a gaming computer, so I'm only spending $700-$800 on a laptop. I'm also considering to buy a really nice home theatre system with really nice base, but thats a maybe still.
Is there anything else that's nice these day's that is a must buy?
I'm not going to be converting to paypal for hackforum's but the money I have on my paypal might go towards leet/ubers & rich bitch award.
Anything cool, doesn't matter price that is cool to have?
Suggest anything , any price and if a link is possible that would be great , hopefully I get good feedback on this.
Hey guy's. First of all I'm posting this because hackforums sometimes has good advice on things to buy. So here it is.
I'm getting a summer job of course in the summer, it's a full time job as a landscaper I get like $11 or $12 per hour (cheap but I'm only 15 + first job).
I'm turning 16 in the summer as well so yeah.
But the thing's I have in mind when I get this money is
* Laptop
* New Computer Desk
* New Computer Chair
* T.v wallmount :) (40 inch)
* Xbox 360 (Last one got banned)
* 1-2 Computer monitors.
I recently bought a gaming computer, so I'm only spending $700-$800 on a laptop. I'm also considering to buy a really nice home theatre system with really nice base, but thats a maybe still.
Is there anything else that's nice these day's that is a must buy?
I'm not going to be converting to paypal for hackforum's but the money I have on my paypal might go towards leet/ubers & rich bitch award.
Anything cool, doesn't matter price that is cool to have?
Suggest anything , any price and if a link is possible that would be great , hopefully I get good feedback on this. <br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<a href="#middle">heys</a>
</body>
</html>
* - Xon - May 26, 2010
Make a div that you put all the data in and make it auto scroll and then only call that function for that certain div
|