Solved

javascript news slide

Posted on 2006-06-14
10
181 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

815 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now