JavaScript - Need Image(s) To Appear Until Div Is Scrolled To The Bottom
I have a scrolling div that has overflow set to hidden. I currently have it set up with a script that allows it to click and drag to scroll. However, I need some kind of visual indicator to show that you can scroll (sometimes it isn't obvious).
I want to know if there's a way to have an image appear until you scroll to one end of the list or the other (the image can be inside the div, or outside). So in other words, there would be a down arrow at the bottom of the list any time you can scroll down (aka everywhere but the bottom) and an up arrow any time you can scroll up (aka everywhere but the top). Some type of fade out animation would also be nice, but not necessary if it over-complicates things. They would just be images, not functioning buttons. I would greatly appreciate any help. Thank you. Similar TutorialsHello everyone, I just stumbled across this forum and thought maybe someone here could help me with a few coding alterations. I would like to position the rss feed selection fields on this feed output so I can scroll the feed with the selection fields remaining stationary. Code: <link rel="icon" type="image/png" href="rss_include/feed-icon-red.png"> <style language='text/css'> @import url('rss_include/style.css'); </style> <script language="javascript"> var XMLHttpRequestObject = false; var img = new Image(); img.src = "rss_include/loading.gif"; if ( window.XMLHttpRequest ) XMLHttpRequestObject = new XMLHttpRequest(); else if (window.ActiveXObject) XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); function changeOptions() { LoadFeed(); } function LoadFeed(value, initial) { if ( XMLHttpRequestObject ) { var dsource = "rss_include/ajax.php?loadfeed"; if (value) dsource += "=" + value; else { var val = document.getElementById("rss_feed").value; if ( val == "" ) document.getElementById("rss_feed").selectedIndex += 1; dsource += "=" + document.getElementById("rss_feed").value; } dsource += "&fulltext=" + document.getElementById("showtext").checked; dsource += "&showimages=" + document.getElementById("showimages").checked; XMLHttpRequestObject.open("GET",dsource); XMLHttpRequestObject.onreadystatechange = function() { if ( XMLHttpRequestObject.readyState != 4 ) { document.getElementById("rss_div").innerHTML = "<center><img class=\"loading\" src=\"" + img.src + "\"></center>"; } if ( XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200 ) { document.getElementById("rss_div").innerHTML = XMLHttpRequestObject.responseText; } } XMLHttpRequestObject.send(null); } } </script> <?php require_once("rss_include/config.php"); function LoadFile($xml_file) { $xml = null; if ( !file_exists($xml_file) || !($xml = simplexml_load_file($xml_file)) ) { echo '</select>'; echo "Error opening XML feeds file: $xml_file<br>"; return; } return $xml; } function ShowFeedOptions($xml_file) { echo '<select id="rss_feed" onChange="LoadFeed(this.value)" title="GuyWMustang.com RSS Reader">'; $xml = LoadFile($xml_file); if ( $xml == null ) return; $url = array(); foreach($xml->feeds->category as $category) { echo "<option value=\"\">" . $category['name'] . "</option>"; foreach($category->feed as $feed) { if ( $feed['name'] != "" ) { // Add a spacing to the feeds $name = " " . $feed['name']; $url = str_replace("&", "%26", $feed['url']); $url = str_replace("http://", "", htmlspecialchars($url)); echo "<option value=\"$url\">" . $name . "</option>"; } } } echo '</select>'; $options = array(); $rss = $xml->options[0]; if ( strcasecmp($rss['fulltext'],"true") == 0 ) array_push($options, "true"); else array_push($options, "false"); if ( strcasecmp($rss['images'],"true") == 0 ) array_push($options, "true"); else array_push($options, "false"); return $options; } function SetOptions($options) { if ( sizeOf($options) == 2 ) { echo "<script>document.getElementById(\"showtext\").checked = " . $options[0] . ";</script>"; echo "<script>document.getElementById(\"showimages\").checked = " . $options[1] . ";</script>"; } } if ( isset($_GET['links']) ) { $xml = LoadFile($xml_file); if ( $xml == null ) return; // end the link editing return; } ?> <div class="container" id="container_div"> <a name="top"></a> <div class="header_div"> <div style="display:run-in;float:left;"> <font class="graytext">RSS Feed:</font> <?php $options = ShowFeedOptions($feeds_xml); ?> <input type="checkbox" id="showtext" onChange="changeOptions(this)" checked><font class="graytext">Show Full Article Text</font> <input type="checkbox" id="showimages" onChange="changeOptions(this)" checked><font class="graytext">Show Images</font> </div> <?php SetOptions($options); ?> </div> <div class="rss" id="rss_div"> <script>LoadFeed(document.getElementById('rss_feed').value, true);</script> </div> <!-- <p style="padding:0px;margin-right:2px;margin:0px;" align="center"><a class="top" href="#top">Top</a></p> --> </div> <-- CSS BELOW --> Code: body { overflow: auto; font-family: arial; } div.header_div { position: relative; /*background-color: #EFEFEF;*/ width: 100%; overflow: auto; margin: auto; } div.container { /*border: 1px solid black; background-color: #EFEFEF;*/ position: relative; margin: auto; display: block; overflow: auto; /* SPECIFY HEIGHT & WIDTH AS DESIRED */ height: 90%; width: 80%; } div.rss { width: 99%; margin: 2px; background-color: tan; position: relative; /*border: 1px solid black;*/ } img.loading { position: relative; margin-top: 50px; } a.rss_link,a.rss_link:active { display: inline; color: blue; } a.rss_link:hover { color: #BBBBFF; } a.rss_link:visited { color: black; } a.top,a.top:active { text-decoration: none; font-size: 10pt; display: inline; color: black; } a.top:hover { text-decoration: underline; color: brown; display: inline; } font.graytext { font-size: 10pt; color: #444444; } font.rss_title { font-size: 12pt; font-weight: bold; text-decoration: underline; } font.rss_date { font-size: 9pt; font-weight: normal; color: black; display: block; } font.rss_description { font-size: 12pt; color: blue; } select { color: black; font-size: 10pt; background-color: #EAEAEA; } any help would be greatly appreciated.....thanks I have been at this for days now. THe problem is these scripts dont work well accross all browsers. I like how this script works but it opens a full window. And wont let me add table. http://www.dynamicdrive.com/dynamicindex4/logo_dev.htm But I can not get it to work with a table. The links I want to open a new window without scrolling, sizeable and toolbar. <table border="0" align="right" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td> <a href="unsaved:///Contact Us" onClick="MyWindow=window.open('https://domain.com/contactus.html"><img src="https://domain.com/images.gif" alt="Contact Us" border="0"></a> </td> </tr> <tr> <td> <center> <font face="Arial" size="3" color="#0000FF">call US</font> </a> </center> </td> </tr> <tr> <td> <center></a>or<a href="mailto:sales@domain.com"> Email Us</a> </center> </td> </tr> </table> Please help! trying to find a example of when you hover over a image, text appears on the bottom so it could be a picture of a dog, whne you put your mouse over it, text will show in the picture (ie* transparent background for text so it's readable) anywhre where I can find a example of this???? Hi there! I am using GlassBox "http://www.glassbox-js.com/" As a light box on a website. Basically, You click an thumbnail image, and a window pops up with a larger version of that image. Now originally, the window opened X number of pixels from the top of the page. However, My thumbnail images were located mid page, so when you clicked on one, the window would open at the top of the page and the user would not see it unless they scrolled up. So I attempted to modify the script so that it would get the users page width/height and display it directly in the center no matter the position. Now my problem is that the script only works when the user has already scrolled down. So if the page is scrolled all the way to the top, and you click on a thumbnail, the window will not open center screen. Here is an example: http://synaxis.pcriot.com/ When the page loads, DO NOT scroll it, and click on the image. You will see the window pop up, and not centered, like it should be. However, now if you scroll down, and click the image again, you see that it is now centered. I also noticed that when the page is scrolled up, and the image does not center, it always is placed below the thumbnail image, or otherwise where ever the DIV is located. It normally located under the image, but if i place the DIV at the top of the page then the window will pop up there. And this does happen on every browser that I have tested, Firefox, IE, and Chrome. So, I am pretty much stumped as to why this is happening. If anyone can shed some light I would be very grateful. Thank You Here is a link to the original code: http://synaxis.pcriot.com/javascript...ox/glassbox.js And modified code: http://synaxis.pcriot.com/javascript...ox/glassbox.js The modified code is at the very bottom of the script. Original Code: Code: /** * @public */ if ( typeof($) == 'undefined' ) { $ = function (id) { return document.getElementById(id); } } Modified Code Code: /** * @private */ var removeElement = function(id) { var Node = document.getElementById(id); Node.parentNode.removeChild(Node); } /** * @private */ var getDocHeight = function() { var db = document.body; var ddE = document.documentElement; return Math.max( db.scrollHeight, db.offsetHeight, db.clientHeight, ddE.scrollHeight, ddE.offsetHeight, ddE.clientHeight ); } /** * @public */ if ( typeof($) == 'undefined' ) { $ = function (id) { return document.getElementById(id); } } Hi all, I'd like to put all my js files at bottom, before the </body>, for Speeding Up my Site. I moved this type of code: Code: <script language="javascript" type="text/javascript" src="javascript.js"></script> from head to bottom, before the end tag of body. But it doesn't work. Why? Is it possible? Furthermore Validator W3C passed these pages. Thank you very much I am working on a ajax chat system right now and I've ran into a little problem. I have no idea how to go about doing this but I know there has to be a way of doing this because I've seen it done before on other ajax chats I've seen. How do I ago about moving the scrollbar of a div to the bottom so that it shows the last that has been entered into the chat. If you need me to explain more then just let me know. But basically I'm wanting the scrollbar when it overflows in the window of a div to go and to the bottom when someone enters something new to the chat. Hi, Is there any possibility of having the JW player playlist at the bottom. If possible can anyone post the javascript and its attribute for that. Thanks, Ananth I try to auto scroll to bottom of a div when the page is loaded. It works on firefox but it is not working on IE. How to scroll to bottom on a div when page is loaded on IE? You can test it by copy paste my codes into two html files. test5.html : Code: <div id='div' style='overflow:scroll; height:300px; width:200px; border:1px solid blue; background:yellow;'> </div> <script src="javascripts/jquery-1.5.js" type="text/javascript" language="javascript"></script> <script type="text/javascript"> function showrsp(){ jQuery.get("test5a.html", function(data) { $('#div').append(data); $(document).ready(function(){asd();}); }); }; function asd(){ $('#div').scrollTop($('#div')[0].scrollHeight); } showrsp(); </script> test5a.html : Code: <p>asdasdas</p> <p>asdasdas</p><p>asdasdas</p><p>asdasdas</p><img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> <p>asdasdas</p><p>asdasdas</p><p>asdasdas</p><img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> <p>asdasdas</p><p>asdasdas</p><p>asdasdas</p><img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> <img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /><img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> <img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /><img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> <img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /><img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> <img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> <p>asdasdas</p><p>asdasdas</p><p>asdasdas</p> <p>asdasdas</p><p>asdasdas</p><img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> <p>asdasdas</p><p>asdasdas</p> <p>asdasdas</p><p>asdasdas</p><img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> <p>asdasdas</p><p>asdasdas</p><img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> <p>asdasdas</p><p>asdasdas</p><img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> <p>asdasdas</p><p>asdasdas</p><img src="http://2aek.com/inventory/emoticons2/69.gif" border="0" /> How to wait until innerHTML finish render the contents before execute function asd()? hello i use this script, and its working so far. except i want the element to stick to the bottom not the top.. http://javascriptkit.com/javatutors/static3.shtml i am a absolute java-noob and if anyone has a hint for me, i would be happy i already tried to rename some words to bottom, but this doesnt work (ie iebody.scrollTop to iebody.scrollBottom) thanks a lot, regards florian I have an iframe on my page which currently shows a separate website (one that i do not control). I'm trying to have the iframe automatically scroll to the bottom of the page. I'm pretty sure this is doable through javascript. The website does not have any anchor(s) or anything else that would be useful for what I'm trying to do. I've been stuck on this for over an hour now.. so please help Here is my code <iframe name="frame" id="frame" width="880px" height="600px" src="website" scrolling="no" frameborder="0"></iframe> Im looking for a script to show a sliding popup from bottom right to upward direction after the page is loaded with a close button to.
I'm admittedly green in this area [among others!], but will there be any issues with any browsers loading the url below with the scripts at the bottom of the page like I have them? http://alton.k12.mo.us/index.html FF loads them fine for me, as does IE *until* I hit the compatibility mode button, then it seems to sort of "hang"...but with IE, I'm not really ever sure of what it's doing is correct or not? I am trying to use these two js codes in one page: http://acrisdesign.com/2010/03/jquer...on-hoverclick/ http://www.huddletogether.com/projects/lightbox2/ They both work perfectly fine except when both linked up at the same time. Only the last one will work. I've tried to find how the codes are working when the page loads in order to fix that problem but I cant figure it out for these two specific codes. Thanks. i want the scrollbars to be preset at the bottom of the div each time someone visits the site. Code: <div id="scroller-shoutbox" border="0" cellspacing="0" style="background-image:url(images/table-bg.png);border-bottom:solid 1px #333; width:498px; height:300px;border-left:solid 1px #333;border-right:solid 1px #333; overflow-x: hidden; overflow-y: auto;"> <table border="0" cellspacing="0" width="500"> <tr><td></td></tr> <!--- PHP array here in actuallity, but i figured it wasnt relevant to this post ---> <tr><td></td></tr> </table> </div> you can see the problem i am talking about here http://tomhilsee.com/ipool/index.php the latest content is unseen because the scrollers are at the top . . . .Within my website (so I control all pages) I often make anchor-links from one page (call it currentpage.htm) to an anchor-link in another page (newpage.htm). Imagine that newpage.htm has two anchor-locations, one near the page-beginning (#high) and one near the page-end (#low). . . . .There is a problem when linking to newpage.htm#low (or an inside-the-page link to #low) because the page-end goes to the bottom of the browser window, and the location (#low) appears somewhere in the vertical middle of the browser window, so it's difficult for a user to know where they should begin reading, and they get confused. . . . .A low-tech solution is to "make the page longer" by adding space to the page-bottom with a series of <p> </p>, or with a tall blank spacer-gif. But this implies something false, it tricks a user into thinking the page is longer than it is, so they may think "this page is too long, I don't want to read that much" and they go away, or they "skim" when they could read more slowly. . . . .Is there a solution using javascript? . . . .If yes, I assume the javascript must be located within newpage.htm, because a command within currentpage.htm can't "tell another page" what to do. Is this correct? I'm not confident because I'm a novice with using javascript. . . . .So is there a way to say, within newpage.htm, "make the page longer by adding a blank spacer-gif to the page-end when an incoming link goes to newpage.htm#low" but to have this be temporary, so when newpage.htm is opened the next time normally (with a link to newpage.htm or to newpage.htm#high) the spacer-gif is gone? CraigR Hello, I am fairly new to Javascript, but so far I have managed to have the page auto scroll when you browse. I was also able to get a button that toggles the start/stop of the scrolling. What I need to happen is when the scrolling reaches the bottom of the screen, I need it to refresh. Is this possible? Thank you in advance!!! Code: function movediv() { booking_details.style.top = document.body.scrollTop; } --------------- <style> .demo {color:#000000; border-color:#666666; background-color:#FFCC00; font-family:Verdana, Arial, Helvetica, sans-serif; font-weight:bold; layer-background-color:#cccccc; position:absolute; left:12.5%; bottom:0px; width:100%; height:100px; visibility:hidden; z-index:5; border-color:#FFFFFF; border:inherit;} </style> --------------- <body onScroll="movediv();"> <div id="booking_details" class="demo" style="visibility:hidden"> .... .... code ..... .... </div> </body> When i scroll the DIV sticks to the TOP of the browser, is there any way to make it sticks to the BOTTOM of the browser as you scroll? Code: <script type='text/javascript' src='http://www.feedzilla.com/tools/swfobject.js'></script> <script type='text/javascript'> var flashvars = {id:'5018093150881',code:'flash',c:'',scroll:'v',prov:'news',cat:'Sports',cat2:'Basketball - NBA',width:'728',height:'90',num_articles:'10',show_summaries:'Yes',show_sources:'Yes',show_dates:'Yes',related_show:'No',vid:'',title:'',title_size:'12pt',title_bold:'Yes',keywords:'',url:'',headers_size:'14pt',font_size:'10pt',font_family:'Arial',text_alignment:'Left',space:'Yes',titlecolor:'#e53211',fcolor:'#000000',desccolor:'#ffffff',sourcecolor:'#e53211',datecolor:'#888888',bgcolor:'#000000',ref:document.location.href}; var params = {scale:'noscale',salign:'lt',bgcolor:'#000000'}; var attributes = {}; swfobject.embedSWF('http://www.feedzilla.com/widgets/news-widget.swf', 'Feedzilla_news_widget_501809963', '728', '90', '9.0.0','',flashvars, params, attributes); </script> <div id='Feedzilla_news_widget_501809963'></div> That produces this: I want to get rid of that strip on the bottom that says "Get This" which stretches all the way across. Is there anything I can change in that code to make this happen? Hopefully this is a noob and simple question to answer, but I used this random ads script and modified it to show random boxarts for PS3 games.. http://javascript.internet.com/misce...andom-ads.html You can see what I'm trying to do he http://empireelite.org/index2.htm - (temporary page just for testing the code, refresh and see that the PS3 boxarts become randomized) Everything looks perfect in Internet Explorer, but in Firefox it looks to have about 15px in spacing on both top and bottom. I know the table itself is fine, because everything fits fine on the real main page http://www.empireelite.org/ The pictures are also not overlapping the cell. It's 9 pics x 22 width, (198px in a 200px wide cell) and it has the same spacing even if I just have 1 pic there using the script. Is there a code I can add or remove to get rid of the spacing in Firefox? I already removed , spacing from this line: function randomorder(targetarray, spacing) { and removed +spacing from this line: document.write(targetarray[the_one]+spacing) Neither did anything and the script works the same way without those small pieces of code (I'm not sure what either of them did to begin with). Here is the javascript page I'm using: http://empireelite.org/randomAds.js And also View Source in this test page: http://empireelite.org/index2.htm |