Solved

javascript news slide

Posted on 2006-06-14
10
182 Views
Last Modified: 2008-01-16
hi all
i m showing the news like that
  <marquee scrollamount=1 scrolldelay=50 direction=up width=165 height=180  id="marq"  >
NEWS
NEWS
NEW
</marquee>
but i want to enhance in news panel
like
if i move my mouse in the upper area of news panel than news will scroll down and when i move the mouse pointer on the bottom then news will scroll up side
can any body tell me how i gonna make this possible
and if some body know any script like that or sample please reply me thanks
0
Comment
Question by:mubbsher
10 Comments
 
LVL 15

Expert Comment

by:deepaknet
ID: 16903226
Did you check out http://www.dynamicdrive.com/?
0
 

Author Comment

by:mubbsher
ID: 16903237
yes i check but i couldnt found any proper script
0
 
LVL 7

Expert Comment

by:geordie007
ID: 16903238

you should NOT use the marquee tag. the marquee tag is not part of the HTML specification, and will not pass any validation test.

you can find a whole host of scroller examples and techniques here:

http://www.dynamicdrive.com/dynamicindex2/index.html
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:mubbsher
ID: 16903991
i coundnt find proper script
please give me the exact url of script
0
 

Author Comment

by:mubbsher
ID: 16904334
i have check all the links on that page
http://www.dynamicdrive.com/dynamicindex2/index.html
but i still cant find the script which is suitable for my requirement
please help
0
 
LVL 28

Accepted Solution

by:
Pravin Asar earned 50 total points
ID: 16906786
Here is one what you are looking for.

<html>
<head><title>Marquee Direction Control</title>
<!-- Copyright PravinAsar http://www.asarconsultants.com -->
</head>
<body>
<script language="javascript">
var isFirefox = 0;
if (navigator.userAgent.match('Firefox')) {
isFirefox = 1;
}
function getX(evt) {
      if (document.all) { return (evt.clientX); }
      else if (isFirefox) { return (evt.clientX); }
      return (evt.layerX);
}
function getY(evt) {
      if (document.all) { return (evt.clientY); }
      else if (isFirefox) { return (evt.clientY); }
      return (evt.layerY);
}
function getTarget(evt) {
      if (document.all) { return (evt.srcElement); }
      return (evt.target);
}
function GetTagPosition (tagObj) {
      this.x = tagObj.offsetLeft;
      this.y = tagObj.offsetTop;
}
function GetTagDimension (tagObj) {
      this.width = tagObj.offsetWidth;
      this.height = tagObj.offsetHeight;
}
function ChangeDir (evt) {
  if (!evt) { evt = window.event; }
  var trgObj = null;
  var x =0; y =0;
  x = getX(evt);
  y = getY(evt);
  trgObj = getTarget(evt);
  if (trgObj) {
    var pos = new GetTagPosition(trgObj);
    var dim = new GetTagDimension(trgObj);
      x -= pos.x;
      y -= pos.y;
    if ( y < dim.height/2) {
        var dir = 'down';
    }
    else {
        var dir = 'up';
    }
    window.status = 'Dire ' + dir;
      trgObj.direction = dir;
  }
}
</script>
<marquee id="ScrollTxt" scrollamount="2"
direction="up" loop="true" width="250" height="200" scrolldelay="10" onmousemove="ChangeDir(event)"  style="border: red solid 5;">
<br>This is a marquee with
<br>direction control based on
<br>mouse position over it.
<br>If mouse is in the upper half
<br>it scrolls down
<br>If mouse is in the lower half
<br>it scrolls up
</marquee>
</body>
</html>
0
 

Author Comment

by:mubbsher
ID: 16909008
yah it working on the independent page
thanks for help
but i want to include the news.php page in other files when i m going to include only slide is working but on mouse up and mouse down scrolling is not moving up and down
wht should i do
thanks for putting me on the track pravinasar
0
 
LVL 28

Expert Comment

by:Pravin Asar
ID: 16910556
To include news.php in other page, you may use iframe



0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question