A short while ago, I posted a way of getting a vertical scroller (
here). With some recent threads about scrolling marquees, I decided to do a horizontal version.
There are a number of scrollers around from sites such as Dynamic Drive, but you normally have to hand-code the HTML of the scroller content.
I decided to try a different approach so we can have all the layout tools of WebPlus available for the content. The content can include images, even Flash.
In the attached file, the content is placed on a page that I have named 'News' (news.html). This can be made any height and is where the content is placed.
The page named 'Two iframes' (two-iframes.html) contains two framed documents, both are the same size as the 'News' page. The width of the 'Two iframes' page is therefore twice the width of the 'News' page. The height of the page and iframes needs to be the same height as the 'News' page. Both iframes are set to display the 'News' page without scrollbars. Unlike the vertical scroller, it is necessary for the left-hand iframe to have an ID of ifrm_L (so the code can get the width).
The top-level page, currently the home page, has an iframe the same height as the other two pages, but of any desired width. This iframe is set to display the 'Two iframes' page without scrollbars.
There is an HTML fragment on the 'Two iframes' page that contains code for the <head> section of HTML. As there is no code for the <body>, 'Ignore page position' is ticked.
The code currently steps 2 pixels every 50 milliseconds. These are indicated by comments in the code, and can be edited.
The only other code added is also to 'Two iframes' page: press Alt+S to see the all the code for the page and find the line beginning <body . The placeholder __AddCode="PageInBodyTag" is replaced by:
Code:
onmouseover="clearTimeout(t)" onmouseout="newsStep()"
This code is only needed if you want the scroller to stop scrolling on mouse-over.
Having the two iframes on a page duplicates the news content so the scroller does not display blank before restarting. In my view this is a significant improvement over other scrollers.
Please let me know if any of the description is unclear or if anything does not work when you customise it.
File attached is WebPlus10 so users of WebPlus10, WebPlusX2, WebPlusX4 and WebPlusX5 should be able to open it.
5th Aug 2011: file attached below has been updated to give compatibility with WebPlusX5. If it is copied to another project file in WebPlus X5, it may be necessary to check the ID of the left iframe and ensure 'Write ID for this object' is set to 'Yes'.