473,699 Members | 2,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Div Scroll on MouseOver

27 New Member
Hi,

I am using a menu inside a div tag. What i want to do is to add scroll buttons (up and down ) along side div which move the div up and down on mouse over.How can i achieve this?

It would be very nice of you if you can provide a link to the article or blog where solution is provided to my problem.

Thanks in advance,
Saad Alam
Apr 7 '08
15 33784
yokiedinosaur
1 New Member
edit: never mind! figured it out! crisis begets creativity :D

Hi, thank you for posting this code. I was able to implement it and get it to work. Is there a way to have more than one instance of this on a page? I have three separate divs with text in them on one page that I would like to have scroll like this.

I'm sorry if this is has an obvious answer, but I'm a javascript newbie. Thanks in advance for any help!

@gits
Sep 16 '09 #11
gits
5,390 Recognized Expert Moderator Expert
just adapt the scroll_up() and scroll_down() methods with a parameter that allows you to retrieve the corresponding 'instance' ... you might pass the id of the node and use it in the functions ... and don't forget to update the onmouseover-calls :)

kind regards
Sep 17 '09 #12
da1vid
1 New Member
Hello!

Very good joob, thanks a lot!

I have just one question. Is there any possibility that it would be possible to scroll content with mouse wheel?

THANKS A LOT AGAIN!
Sep 18 '10 #13
gits
5,390 Recognized Expert Moderator Expert
you might add a mousewheel listener ... you might have a look here for a start ...
Sep 22 '10 #14
isensmith
1 New Member
Can this solution be easily adjusted to scroll left and right instead of up and down?
thanks
Feb 3 '12 #15
boop
1 New Member
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.     var scrolling = null;
  3.  
  4.     function scroll_left() {
  5.         var d = document.getElementById('scroller');
  6.  
  7.         d.scrollLeft = d.scrollLeft - 5;
  8.  
  9.         scrolling = window.setTimeout(function() {
  10.             scroll_left();
  11.         }, 20);
  12.     }
  13.  
  14.     function scroll_right() {
  15.         var d = document.getElementById('scroller');
  16.  
  17.         d.scrollLeft = d.scrollLeft + 5;
  18.  
  19.         scrolling = window.setTimeout(function() {
  20.             scroll_right();
  21.         }, 20);
  22.     }
  23.  
  24.     function stop_scroll() {
  25.         window.clearTimeout(scrolling);
  26.     }
  27.     </script>
this worked for me!
Jun 6 '12 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3234
by: Michael Hill | last post by:
I'm trying to implement a scrolling div. Here is a test page that was created: http://www.hulenbend.net/test2.html When I mouseover the down arrow I want to be able to move the div up showing more of the content. Any ideas how to expose the content?
14
2353
by: J. Makela | last post by:
Hallo. This should be a pretty entertaining question for you *real* javascript writers.. I, being the lowly photoshop guy at an ad agency made the mistake of actually saying "HTML" in a conversation once.. and now I have been tasked with building a big website with LOTS of fancy javascripting. Image rollovers mostly. Only problem is that I don't really know how to do it. Of course, that's of no consequence so I have to do it anyway....
2
3350
by: Alex | last post by:
On my page I have a lot string like this: <span onmouseover="callMe(this)" onmouseout="callMe(null)" >abc1</span> <span onmouseover="callMe(this)" onmouseout="callMe(null)" >abc2</span> <span onmouseover="callMe(this)" onmouseout="callMe(null)" >abc3</span> <span onmouseover="callMe(this)" onmouseout="callMe(null)" >abc4</span> How can I optimize it? Is it possible to move this definition what to do to style/css or some other common...
2
2022
by: xleonard | last post by:
Hoping someone can help me figure out why some code I'm trying to learn isn't working. I found a javascript scroll effect that I really like on this page: http://www.blocparty.com/go.php?object=music Particularly I'm focusing on the scroll for the "LYRICS" section. My javascript knowledge is pretty limited, but the code seems really simple so I figured I'd be able to learn to use it for myself. I tried implementing it a couple of...
3
19497
by: Annette Acquaire | last post by:
I have and image map with a dozen hotspot links on it that I'm trying to get to open a new image over existing one on mouseover of each COORD. The only thing I was able to do was swap image on mouseover entire image, I want it on each hotspot only, so an image pertaining to each link shows up. I have done it in JavaScript, but the website I'm using doesn't use JavaScript. Y'all are obviously light-years more knowledgeable then me on html...
23
2756
by: Schannah | last post by:
I'm trying to create a design which mimics the Radiohead website in the action on this page, but the problem is that they use PHP for the effect and I have no idea about PHP. I'm very amateur: fairly confident with HTML and can scrape together codes with JavaScript with a lot of research and cursing, but for the life of me I can't see how to mouseover image or text A, get image or text B, mouseover B, get image or text C, and so on. I'm sure it...
1
1959
by: dave345 | last post by:
This javascript issue is in an app using C# / .Net 2.0 running on XP. First post, please mention if I mess up any conventions of this forum. I’ve got a mouseover event that only works properly the second time it fires if the page has been scrolled a lot. The mouseover displays an image in a div that is placed near the mouse cursor. When the rollover occurs near the bottom of the page, the coordinates are altered so that the entire image is...
2
18702
by: Saad Alam | last post by:
Hi, I am using a menu inside a div tag. What i want to do is to add scroll buttons (up and down ) along side div which move the div up and down on mouse over.How can i achieve this? It would be very nice of you if you can provide a link to the article or blog where solution is provided to my problem. Thanks in advance, Saad Alam
3
2587
by: PrabodhanP | last post by:
I have CSS based mouseover scrolling for divContent embeded in my webpage.It works fine in IE,but not working in mozilla-FF. It is located at the location.. http://www.integrityads.net/fashions/collection.htm Also it is not resolution compatible,i.e. alignment totally messed up when i increased the resolution.Please suggest. Code is as follows:- <HTML><HEAD> <meta http-equiv="Content-Language" content="en-us"> <TITLE>Collections</TITLE>...
15
2143
Claus Mygind
by: Claus Mygind | last post by:
I have a <div> tag in my app that I minimize on the screen thereby only showing the top line of the content in that division. The user activates the content (maximizes the content) with the mouseover event. When active the user can scroll down through the content and mouseout minimizes it again. My problem is this - when the content is minimized to reveal only one line, it is at the point where the user had scrolled to. I would like...
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.