Jump to content

Iframe Auto Scroll, Is This Possible?


zog953
 Share

Recommended Posts

would setting the width of the page to something really wide, like 2000px or something like that, do anything to help?

Edited by thescientist
Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the replies folks, I think you have kind got what I am after.There is a 'kind-of' example here in the news section. The reason I say kind of is that you'll notice they've not used iframes, they've used quite a clever technique though, but in truth I can't get my head around it...This page shows another example-ish http://www.csbsupport.com/samplecode/id284.htmCheers.

Link to comment
Share on other sites

Making a normal <div> scroll is easier than making an iframe scroll.To make an iframe scroll you probably have to access the <body> element that¡s inside the frame and modify its scrollLeft or scrollTop properties. It will only work if the iframe is in the same domain as the main document.With a normal <div> element you just need to modify the scrollLeft ad scrollTop properties of the <div> element.

Link to comment
Share on other sites

Hi zog,I've just checked on w3schools, and marquee isn't on there :)I dunno where its gone, perhaps it was never a w3c standard, but that seems ideal for what you want.Can someone comment as to the situation with marquee? is it a standard? or has it been depreciated?

<!-- HTML codes by Quackit.com --><marquee behavior="scroll" direction="left"><img src="/pix/smile.gif" width="100" height="100" alt="smile" /><p>Sample text under a marquee image.</p></marquee>

Thats an example of both an image and text in a marquee.source: http://www.quackit.com/html/codes/html_marquee_code.cfmThe attributes and values for the tag are:behaviour="slide, scroll, alternate"direction="left, right, up, down"scrollspeed="#"Appologies if this isn't a w3c standard.Thanks,Matthew Millar

Edited by Matthew Millar
Link to comment
Share on other sites

Thanks Ingolme.Zog, if the link i provided shows the kind of thing you're looking for.Try one of these:Javascript way:source: http://javascript.about.com/library/bltick2.htm

var tWidth='300px';				  // width (in pixels)var tHeight='25px';				  // height (in pixels)var tcolour='#ffffcc';			   // background colour:var moStop=true;					 // pause on mouseover (true or false)var fontfamily = 'arial,sans-serif'; // font for contentvar tSpeed=3;						// scroll speed (1 = slow, 5 = fast)// enter your ticker content here (use \/ and \' in place of / and ' respectively)var content='Are you looking for loads of useful information <a href="http:\/\/javascript.about.com\/">About Javascript<\/a>? Well now you\'ve found it.';// Simple Marquee / Ticker Script// copyright 3rd January 2006, Stephen Chapman// permission to use this Javascript on your web page is granted// provided that all of the below code in this script (including this// comment) is used without any alterationvar cps=tSpeed; var aw, mq; var fsz = parseInt(tHeight) - 4; function startticker(){if (document.getElementById) {var tick = '<div style="position:relative;width:'+tWidth+';height:'+tHeight+';overflow:hidden;background-color:'+tcolour+'"'; if (moStop) tick += ' onmouseover="cps=0" onmouseout="cps=tSpeed"'; tick +='><div id="mq" style="position:absolute;left:0px;top:0px;font-family:'+fontfamily+';font-size:'+fsz+'px;white-space:nowrap;"><\/div><\/div>'; document.getElementById('ticker').innerHTML = tick; mq = document.getElementById("mq"); mq.style.left=(parseInt(tWidth)+10)+"px"; mq.innerHTML='<span id="tx">'+content+'<\/span>'; aw = document.getElementById("tx").offsetWidth; lefttime=setInterval("scrollticker()",50);}} function scrollticker(){mq.style.left = (parseInt(mq.style.left)>(-10 - aw)) ?parseInt(mq.style.left)-cps+"px" : parseInt(tWidth)+10+"px";} window.onload=startticker;

This version appears to use a div element as apposed to marquee, so it should be standards compliant. :)CSS 3 way:O yes! Theres a way of using marquee, in the upcoming release of CSS 3:source: http://www.w3.org/TR/css3-marquee/By the looks of it if you add

{overflow: auto; overflow-style: marquee-line; white-space: nowrap}

into an li (i'd imagine div will work just as well) css whatever can't be displayed will automatically overflow, however, it will then scroll from one extreme to the other.Hope this helps,Matthew Millar

Edited by Matthew Millar
Link to comment
Share on other sites

I think looking at the javascript code for the marquee, I am not sure that will work with image files. Am I right in understanding that is for text?I think I am going to look into the <div> tag option as suggested below (many thanks), despite having no experience of using them. They seem to be the great liberator of the not so flexible html world, probably why I have not used them... my web design is very antiquated.

Making a normal <div> scroll is easier than making an iframe scroll.To make an iframe scroll you probably have to access the <body> element that¡s inside the frame and modify its scrollLeft or scrollTop properties. It will only work if the iframe is in the same domain as the main document.With a normal <div> element you just need to modify the scrollLeft ad scrollTop properties of the <div> element.
If anyone has any useful tutorials (I have read w3) that mention bit on how to position and style to a more advanced level that would be great. I am currently looking at the Lissa Explains tutorial which covers the basics nicely.Thanks for your help / advice.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...