You can make your own plugins and use them privately in your code or you can release them into the wild. The barrier to creating a plugin of your own is so low that you'll want to do it straight away!
One of the great aspects of jQuery is its extensibility, as evidenced by the many excellent plugins that have been developed for it.
<div id="marquee-me">Yo Wassssup!</div>
The Usage:
var marquee = new Marquee(document.getElementById("marquee-me"));
window.setTimeout(function() { marquee.stop(); }, 5000);
The Code:
http://jsbin.com/uhofov/7/editmarquee.moveItMoveIt();
...without it doing everything twice.var marquee = new Marquee(document.getElementById("marquee-me")); var marquee2 = new Marquee(document.getElementById("marquee-me"));
window.setTimeout(function() { marquee.stop(); }, 5000);
var marquee = new Marquee(document.getElementById("marquee-me"),
{direction: 'forwards', distance: 100});
window.setTimeout(function() {
var marquee2 = new Marquee(document.getElementById("marquee-me"),
{direction: 'backwards', distance: 1});
}, 2000);
defaults: {
'direction': 'forwards', // 'forwards' or 'backwards',
'distance' : '10' // any integer
}
<div id="marquee-me"
data-marquee-direction="backwards"
data-marquee-distance="5">
Yo Wassssup!
</div>
<div id="marquee-me"
data-marquee
data-marquee-direction="backwards"
data-marquee-distance="5">
Yo Wassssup!
</div>
var marquee = new Marquee(document.getElementById('marquee-me'));
marquee.on('reverse', function() { document.getElementById('marquee-me').innerHTML = marquee.direction; });
define("lib/marquee", function(Marquee) {
var marquee = new Marquee(document.getElementById('marquee-me'));
});
<div data-readme="watchlist-announcement" data-readme-show-count="1" data-readme-show-until-closed="data-readme-show-until-closed" data-readme-show-expires="Jun 15, 2013" class="hide readme">
We now give students the ability to "watch" classes they're interested in, which replaces the need for TBA sessions. <a href="https://class.coursera.org/mooc/forum/thread?thread_id=472" target="_blank" data-readme-close="data-readme-close">Read more here.</a>
<div data-readme-close="data-readme-close" class="readme-close-icon"><span class="icon-remove"></span></div>
</div>
new Readme(this.$('.readme'));
<div data-modal-overlay-class="coursera-overlay-dark" class="modal coursera-course-selfstudy-modal hide">
<div class="modal-header"><h2>What is "self study"?</h2></div>
<div class="modal-body"><p>Self-Study bla bla bla....</p></div>
<div class="modal-footer"><button data-modal-close="data-modal-close" class="btn btn-primary">OK, I got it!</button></div>
</div>
<a data-modal=".coursera-course-selfstudy-modal" role="button">?</a>
or
Modal(this.$('.coursera-course-self-study-modal')).open();
<li class="course-topbar-nav-list-item"
tabindex="0" role="button" aria-haspopup="true"
aria-expanded="false" aria-owns="course-topbar-aboutus"
data-popup="#course-topbar-aboutus"
data-popup-bind-open="mouseenter" data-popup-direction="se">
<a>About <i class="icon-caret-down"></i></a>
</li>
<div id="course-topbar-aboutus" class="course-topbar-sublist">
<a class="course-topbar-sublist-item" href="/about/jobs">Jobs</a>
<a class="course-topbar-sublist-item" href="/about/team">Team</a>
</div>
It's good to learn how to do something. It's better to learn many ways of doing something. But it's best to learn all these ways as suggestions or hints . Not truth.