Results 1 to 8 of 8

Thread: How to get this scrollbar JS to work on the whole webpage?

  1. #1
    Join Date
    Jul 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to get this scrollbar JS to work on the whole webpage?

    I found a scrollbar javascript that I would love to implement for my website here: http://www.dynamicdrive.com/dynamici...roll/index.htm
    The problem is the script appears to be meant for a text box (like their demo) rather than for the actual scrollbar on the right side of a webpage.

    I've tried giving my #body an id and then calling the same id for the scripting in the HEAD section, but that didn't work.
    <script type="text/javascript">
    jQuery(function(){ // on page DOM load
    $('#bodyid').alternateScroll();
    })
    </script>
    Anyone know what changes I must make to use this javascript for my website's main scrollbar?
    Thanks.

  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    You could do this:
    Code:
    <body id="bodyid" style="height: 98%">

  3. #3
    Join Date
    Jul 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    sorry but where am I suppose to put that line in? Within the head section or the body section? Or should I replace a previous line with that?

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    That would be your revised body tag, under the closing head tag. You're probably used to seeing it look like <body>
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  5. #5
    Join Date
    Jul 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    oh thanks, but I dont understand how that would make it work. I've already id my body, and adding the style="height: 98%" part didn't seem to change anything

  6. #6
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Quote Originally Posted by stormcloudseven View Post
    I've already id my body.
    You mean you've already an ID for your body? What's the ID, then?
    It works with me.

  7. #7
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Of course substitute in whatever ID you already have - minus this information or a link to your actual web page in the original post, Arie did the most helpful thing of providing you with a complete example with an alternative ID to illustrate.

    Arie has advised that his solution works at his side, but we so far do not know anything else about your actual web page, which makes it very difficult to tailor help to your specific needs.

    The reason that it might not be working for you could be that you have too little content to trigger the scrollbar at your side. Or maybe there are other javascripts/resources that are causing conflicts.

    The best step now would be for you to provide a link to your actual web page - nobody likes to guess - with the problematic page in front of us, we can give faster, more accurate suggestions.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  8. #8
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    I forgot to mention that the body must have also: position: absolute. Here's a working example:
    Code:
    <!doctype html>
    <html >
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    
    <title></title>
    
    
    <link href="general.css" rel="stylesheet" type="text/css">
    
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
    <script src="jquery.ui.touch-punch.min.js"></script>
    
    <script src="facescroll.js">
    /***********************************************
    * FaceScroll custom scrollbar (c) Dynamic Drive (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit http://www.dynamicdrive.com/ for this script and 100s more.
    ***********************************************/
    </script>
    
    <script>
    jQuery(function(){
    $('#bodyid').alternateScroll({ 'vertical-bar-class': 'styled-v-bar', 'hide-bars': false });
    })
    </script>
    
    </head>
    
    <body id="bodyid" style="position: absolute; left: 20px; right: 2px; padding: 0px; margin: 0px; height: 98%; font-family: arial; font-size: 15px">
    <div style="padding-right:30px; padding-left: 3px; padding-top:20px">
    From Wikipedia- Gunpowder, also known since in the late 19th century as black powder, was the first chemical explosive and the only one known until the mid 1800s.[2] It is a mixture of sulfur, charcoal, and potassium nitrate (saltpeter) - with the sulfur and charcoal acting as fuels, while the saltpeter works as an oxidizer.[3] Because of its burning properties and the amount of heat and gas volume that it generates, gunpowder has been widely used as a propellant in firearms and as a pyrotechnic composition in fireworks. Gunpowder was, according to prevailing academic consensus, discovered in the 9th century in China, attributed to Chinese alchemists searching for an elixir of immortality.[4] This discovery led to the invention of fireworks and the earliest gunpowder weapons in China. In the centuries following the Chinese discovery, gunpowder weapons began appearing in the Arab world, Europe, and India. The consensus is that this was spread from China, through the Middle East, and then into Europe,[5] although there remains some dispute over the amount of Chinese influence on later advancements in gunpowder technology. Gunpowder is classified as a low explosive because of its relatively slow decomposition rate and consequently low brisance. Low explosives deflagrate at subsonic speeds, whereas high explosives detonate, producing a supersonic wave. Ignition of the powder packed behind a bullet must generate enough pressure to force it from the muzzle at high speed, but not enough to rupture the gun barrel. Gunpowder is thus less suitable for shattering rock or fortifications. Gunpowder was widely used to fill artillery shells and in mining and civil engineering to blast rock roughly until the 2nd half of the 19th century, when the first high explosives (nitro-explosives) were discovered. Gunpowder is no longer used in modern explosive military warheads, nor is it used as main explosive in mining operations due to its cost relative to that of newer alternatives like ANFO.<br><br>
    
    From<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a
    <br><br>
    
    From Wikipedia- Gunpowder, also known since in the late 19th century as black powder, was the first chemical explosive and the only one known until the mid 1800s.[2] It is a mixture of sulfur, charcoal, and potassium nitrate (saltpeter) - with the sulfur and charcoal acting as fuels, while the saltpeter works as an oxidizer.[3] Because of its burning properties and the amount of heat and gas volume that it generates, gunpowder has been widely used as a propellant in firearms and as a pyrotechnic composition in fireworks. Gunpowder was, according to prevailing academic consensus, discovered in the 9th century in China, attributed to Chinese alchemists searching for an elixir of immortality.[4] This discovery led to the invention of fireworks and the earliest gunpowder weapons in China. In the centuries following the Chinese discovery, gunpowder weapons began appearing in the Arab world, Europe, and India. The consensus is that this was spread from China, through the Middle East, and then into Europe,[5] although there remains some dispute over the amount of Chinese influence on later advancements in gunpowder technology. Gunpowder is classified as a low explosive because of its relatively slow decomposition rate and consequently low brisance. Low explosives deflagrate at subsonic speeds, whereas high explosives detonate, producing a supersonic wave. Ignition of the powder packed behind a bullet must generate enough pressure to force it from the muzzle at high speed, but not enough to rupture the gun barrel. Gunpowder is thus less suitable for shattering rock or fortifications. Gunpowder was widely used to fill artillery shells and in mining and civil engineering to blast rock roughly until the 2nd half of the 19th century, when the first high explosives (nitro-explosives) were discovered. Gunpowder is no longer used in modern explosive military warheads, nor is it used as main explosive in mining operations due to its cost relative to that of newer alternatives like ANFO.<br><br>
    
    From Wikipedia- Gunpowder, also known since in the late 19th century as black powder, was the first chemical explosive and the only one known until the mid 1800s.[2] It is a mixture of sulfur, charcoal, and potassium nitrate (saltpeter) - with the sulfur and charcoal acting as fuels, while the saltpeter works as an oxidizer.[3] Because of its burning properties and the amount of heat and gas volume that it generates, gunpowder has been widely used as a propellant in firearms and as a pyrotechnic composition in fireworks. Gunpowder was, according to prevailing academic consensus, discovered in the 9th century in China, attributed to Chinese alchemists searching for an elixir of immortality.[4] This discovery led to the invention of fireworks and the earliest gunpowder weapons in China. In the centuries following the Chinese discovery, gunpowder weapons began appearing in the Arab world, Europe, and India. The consensus is that this was spread from China, through the Middle East, and then into Europe,[5] although there remains some dispute over the amount of Chinese influence on later advancements in gunpowder technology. Gunpowder is classified as a low explosive because of its relatively slow decomposition rate and consequently low brisance. Low explosives deflagrate at subsonic speeds, whereas high explosives detonate, producing a supersonic wave. Ignition of the powder packed behind a bullet must generate enough pressure to force it from the muzzle at high speed, but not enough to rupture the gun barrel. Gunpowder is thus less suitable for shattering rock or fortifications. Gunpowder was widely used to fill artillery shells and in mining and civil engineering to blast rock roughly until the 2nd half of the 19th century, when the first high explosives (nitro-explosives) were discovered. Gunpowder is no longer used in modern explosive military warheads, nor is it used as main explosive in mining operations due to its cost relative to that of newer alternatives like ANFO.<br><br>
    
    From Wikipedia- Gunpowder, also known since in the late 19th century as black powder, was the first chemical explosive and the only one known until the mid 1800s.[2] It is a mixture of sulfur, charcoal, and potassium nitrate (saltpeter) - with the sulfur and charcoal acting as fuels, while the saltpeter works as an oxidizer.[3] Because of its burning properties and the amount of heat and gas volume that it generates, gunpowder has been widely used as a propellant in firearms and as a pyrotechnic composition in fireworks. Gunpowder was, according to prevailing academic consensus, discovered in the 9th century in China, attributed to Chinese alchemists searching for an elixir of immortality.[4] This discovery led to the invention of fireworks and the earliest gunpowder weapons in China. In the centuries following the Chinese discovery, gunpowder weapons began appearing in the Arab world, Europe, and India. The consensus is that this was spread from China, through the Middle East, and then into Europe,[5] although there remains some dispute over the amount of Chinese influence on later advancements in gunpowder technology. Gunpowder is classified as a low explosive because of its relatively slow decomposition rate and consequently low brisance. Low explosives deflagrate at subsonic speeds, whereas high explosives detonate, producing a supersonic wave. Ignition of the powder packed behind a bullet must generate enough pressure to force it from the muzzle at high speed, but not enough to rupture the gun barrel. Gunpowder is thus less suitable for shattering rock or fortifications. Gunpowder was widely used to fill artillery shells and in mining and civil engineering to blast rock roughly until the 2nd half of the 19th century, when the first high explosives (nitro-explosives) were discovered. Gunpowder is no longer used in modern explosive military warheads, nor is it used as main explosive in mining operations due to its cost relative to that of newer alternatives like ANFO.<br><br>THE END<br><br>
    
    </div>
    
    </body>
    
    </html>

Similar Threads

  1. Iframe refresh does not work in my webpage
    By Vaonline in forum JavaScript
    Replies: 1
    Last Post: 01-31-2012, 09:21 PM
  2. Slick Custom Scrollbar script - does not work in IE
    By moal in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 11-22-2011, 07:26 AM
  3. Replies: 2
    Last Post: 11-30-2010, 12:25 AM
  4. Replies: 0
    Last Post: 10-12-2010, 12:57 PM
  5. Replies: 1
    Last Post: 08-17-2010, 05:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •