/    Sign up×
Community /Pin to ProfileBookmark

Mootools ‘onclick’ function

Hi

I am a javascript newbie but would really appreciate some help with this issue.

I am using tutorial do produce a ‘mouseenter’/’mouseleave’ scroll. but I would like it instead on rolling over the webpage to the left and right to make it scroll to be able to click a arrow to make it scroll…

code:

[CODE]<script type=”text/javascript” src=”mootools.svn.js”></script>
<script type=”text/javascript”>
window.addEvent(‘domready’, function(){
var scroll2 = new Scroller(‘container’, {area: 100, velocity: 1});

// container
$(‘container’).addEvent(‘mouseenter’, scroll2.start.bind(scroll2));
$(‘container’).addEvent(‘mouseleave’, scroll2.stop.bind(scroll2));
});
</script>[/CODE]

html:

[CODE]</head>

<body>
<div id=”container”>
<div class=”main-content”>
<div class=”section”>
<h1>Horizontal Scroller</h1>
<strong>Note:
Move your mouse to the right and to the left to scroll to the right and to the left the
content hidden in the main layer.</strong><br /><br />

Move your mouse to the right —-><br /><br />
Take a look at my site
<a href=”http://woork.blogspot.com”>http://woork.blogspot.com</a>
</div>

<div class=”section”>
<h1>Am I using Flash to do it?</h1>
No! Just pure CSS and HTML code…
</div>

<div class=”section”>
<h1>How do it?</h1>
You can implement this effect using Mootools and just some lines of code…<br /><br />
<strong>Move your mouse to the right of the main stage…–></strong>
</div>

<div class=”section”>
<h1>About Me</h1>
Add your content here…
</div>
<div class=”section”>
<h1>Bookmarks</h1>
Add your content here…
</div>

<div class=”section”>
<h1>Social Network</h1>
Add your content here…
</div>

<div class=”section”>
<h1>The end</h1>
<strong> Move your mouse to the left!
&lt;—move!</strong>
</div>

</div>
</div>
</body>
</html>[/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @jon-toda spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...