Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML & JavaScript - Passing the scroll action from one element to another

Suppose I have two divs:

<div id="control"></div>
<div id="view">(A scrollable list)</div>

And I'd like to make it so that when the cursor is parked inside #control and the mousewheel is scrolled, #view will be scrolled instead. Anyway to achieve this?

like image 896
gsklee Avatar asked Dec 24 '12 06:12

gsklee


People also ask

What is HTML used for?

HTML (HyperText Markup Language) is the code that is used to structure a web page and its content. For example, content could be structured within a set of paragraphs, a list of bulleted points, or using images and data tables.

Should I learn HTML before C++?

Pakeeza Saba 2680 It's depend on you which Language you want to choose HTML(markup Language) is used for web development & C++(programming language) is best for game development.. You cannot use C++ in web dvelopment.

Is HTML easy to learn?

HTML is the standard markup language for Web pages. With HTML you can create your own Website. HTML is easy to learn - You will enjoy it!


1 Answers

not sure what the layout looks like

but if they're right next to each other you could use

#control{pointer-events : none}

and change a few things.

Here's a fiddle: http://jsfiddle.net/filever10/QVRNd/

If the elements are not able to be that close, this won't be much help.

It works by putting the control over the list, and disabling pointer events on the control.

like image 191
FiLeVeR10 Avatar answered Sep 27 '22 16:09

FiLeVeR10