/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Mootools Fx.Slide ; unable to duplicate demo

Ok, ive downloaded the mootools library with Fx.Slide, and im trying to put together the same demo that is shown [URL=http://demos.mootools.net/Fx.Slide]HERE[/URL].
I’ve got the css applying but when i hit toggle i get
“Line 4: ‘this.element’ is null or not an object”
Heres my main page
[b]testSlide.html[/b]

[CODE]
<html>
<head>
<title>Slide.FX Test</title>
<script type=”text/javascript” src=”mootools.js”></script>
<script type=”text/javascript” src=”slideDown.js”></script>
<style type=”text/css”>
#test {
background: #222;
color: #fff;
padding: 10px;
margin: 20px;
border: 10px solid pink;
}

#test2 {
background: #222;
color: #fff;
padding: 10px;
margin: 20px;
border: 10px solid pink;
}
</style>
</head>
<body>
<h3 class=”section”>Fx.Slide Vertical</h3>
<a id=”slideout” href=”#”>slideout</a> | <a id=”slidein” href=”#”>slidein</a> | <a id=”toggle” href=”#”>toggle</a> | <a id=”hide” href=”#”>hide</a>
<div id=”test”>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<h3 class=”section”>Fx.Slide Horizontal</h3>
<a id=”slideout2″ href=”#”>slideout</a> | <a id=”slidein2″ href=”#”>slidein</a> | <a id=”toggle2″ href=”#”>toggle</a> | <a id=”hide2″ href=”#”>hide</a>
<div id=”test2″>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</body>
</html>
[/CODE]

Its basically what ive pulled from their demo, the html & css & js code links plus a link to the mootools.js file i downloaded.
Heres the javascript
[b]slideDown.js[/b]

[CODE]
//-vertical

var mySlide = new Fx.Slide(‘test’);

$(‘slidein’).addEvent(‘click’, function(e){
e = new Event(e);
mySlide.slideIn();
e.stop();
});

$(‘slideout’).addEvent(‘click’, function(e){
e = new Event(e);
mySlide.slideOut();
e.stop();
});

$(‘toggle’).addEvent(‘click’, function(e){
e = new Event(e);
mySlide.toggle();
e.stop();
});

$(‘hide’).addEvent(‘click’, function(e){
e = new Event(e);
mySlide.hide();
e.stop();
});

//–horizontal

var mySlide2 = new Fx.Slide(‘test2’, {mode: ‘horizontal’});

$(‘slidein2’).addEvent(‘click’, function(e){
e = new Event(e);
mySlide2.slideIn();
e.stop();
});

$(‘slideout2’).addEvent(‘click’, function(e){
e = new Event(e);
mySlide2.slideOut();
e.stop();
});

$(‘toggle2’).addEvent(‘click’, function(e){
e = new Event(e);
mySlide2.toggle();
e.stop();
});

$(‘hide2’).addEvent(‘click’, function(e){
e = new Event(e);
mySlide2.hide();
e.stop();
});
[/CODE]

Not sure why this isn’t duplicating the demo page, since its the code they provided. Maybe its something simple.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@EmerickauthorOct 04.2007 — Well, nevermind. It turns out you need to wrap your javascript in
<i>
</i>window.addEvent('domready', function() {
// js code here
});

sweet
×

Success!

Help @Emerick 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...