Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
jquery.marquee
Advanced tools
jQuery plugin to scroll the text like the old traditional marquee http://aamirafridi.com/jquery/jquery-marquee-plugin — Edit
A ~8 KB (minified) jQuery plugin to scroll the text like the old traditional marquee.
npm install jquery.marquee --save
<script src="//cdn.jsdelivr.net/npm/jquery.marquee@1.6.0/jquery.marquee.min.js" type="text
/javascript"></script>
bower install jQuery.Marquee
true
allowCss3Support
is set to true
. See here for full list. Default: 'linear'
'linear'
1000
'left' / 'right' / 'up' / 'down'
. Default: 'left'
. Todo: need to change this to ltr/rtl
etcfalse
5000
.duplicated
option is set to true
. Default: 20
. Note: 20
means 20px
so no need to use '20px'
as the value.allowCss3Support
is set to true
this will be done using CSS3. Otherwise this will be done using the jQuery Pause plugin. Default: false
. See demo page for example.delayBeforeStart
milliseconds.true
. Thanks to @nuke-ellington 👍These methods can be used like this:
var $mq = $('.marquee').marquee();
var $mq.marquee('NAME-OF-METHOD-AS-STRING');
Here is the list of all methods:
finished
event so you can have the marquee show some data and as soon as it finishes showing that, you can destroy it, change the html and then apply the plugin again. See the demo page for details (links provided above).Here's how to import the plugin as a CommonJS module:
var $ = require("jquery");
require("jquery.marquee");
Usually you assign the marquee class to the desired element. Then you initialize it with an options hash in your code (see below).
<div class='marquee'>Lorem ipsum dolor sit amet, consectetur adipiscing elit END.</div>
Alternatively you can provide all the options listed above as data attributes:
<div class='marquee' data-duration='5000' data-gap='10' data-duplicated='true' >
Lorem ipsum dolor sit amet, consectetur adipiscing elit END.
</div>
.marquee {
width: 300px; /* the plugin works for responsive layouts so width is not necessary */
overflow: hidden;
border:1px solid #ccc;
}
/**
* Example of starting a plugin with options.
* I am just passing some of the options in the following example.
* you can also start the plugin using $('.marquee').marquee(); with defaults
*/
$('.marquee').marquee({
//duration in milliseconds of the marquee
duration: 15000,
//gap in pixels between the tickers
gap: 50,
//time in milliseconds before the marquee will start animating
delayBeforeStart: 0,
//'left' or 'right'
direction: 'left',
//true or false - should the marquee be duplicated to show an effect of continues flow
duplicated: true
});
import React, { Component } from 'react';
import $ from 'jquery';
import 'jquery.marquee';
class Marquee extends Component {
componentDidMount() {
this.$el.marquee({
duration: 15000,
gap: 50,
delayBeforeStart: 0,
direction: 'left'
});
}
render() {
return (
<div ref={(el) => this.$el = $(el)}>
I'm using jQuery.Marquee with React!!!!
</div>
);
}
}
import React, { useEffect, useRef } from 'react';
import $ from 'jquery';
import 'jquery.marquee';
function Marquee(props) {
const el = useRef();
useEffect(function() {
const $el = $(el.current);
$el.marquee({
duration: 5000,
gap: 50,
delayBeforeStart: 0,
direction: 'left'
});
});
return (
<div ref={el}>
I'm using jQuery.Marquee with React!!!!
</div>
);
}
var $mq = $('.marquee').marquee();
$('.someLink').click(function(){
$mq.marquee('pause/resume/toggle');
});
Change content and re-apply the plugin. Check demo page for example: http://aamirafridi.com/jquery/jquery-marquee-plugin#examples
$('.marquee')
.bind('finished', function(){
//Change text to something else after first loop finishes
$(this).marquee('destroy');
//Load new content using Ajax and update the marquee container
$(this).html('Some new data loaded using ajax')
//Apply marquee plugin again
.marquee()
})
.marquee();
Check demo page for example: http://aamirafridi.com/jquery/jquery-marquee-plugin#examples
$('.marquee')
.bind('beforeStarting', function () {
//code you want to execute before starting the animations
})
.bind('finished', function () {
//code you want to execute before after each animation loop
})
//Apply plugin
.marquee({
duration: 2000
});
If you are using images in marquee, sometimes the plugin cannot calculate accurate widths while images are still loading. You can try this instead of $(document).ready(function(){...})
//if you have images in marquee
$(window).load(function() {
$('.marquee').marquee();
});
Update (8 Mar 2016):
Now plugin have new option: startVisible The marquee will be visible in the start if set to true
. Thanks to @nuke-ellington 👍
Update (24 Jan 2014):
Note: people who been asking me how to use this plugin with content being loaded with Ajax, please read notes about this update.
New methods added, so now after you start the plugin using var $mq = $('.marquee').marquee();
, then you can pause, resume, toggle(pause, resume) and destroy methods e.g to remove the marquee plugin from your element simply use $mq.marquee('destroy');
. Similarly you can use pause the marquee any time using $mq.marquee('pause');
.
If you want to use use Ajax with this plugin i.e you want to change the content after you apply this plugin, please see the examples in demo page (link provided below).
Also made some changes so this plugin works with old versions of jQuery. I have tested it with jQuery 1.3.2 but quite sure it should work with some previous versions of jQuery.
PLEASE report any bugs you find.
For details please check the demos at: http://aamirafridi.com/jquery/jquery-marquee-plugin#examples
Update (20 Dec 2013): Now the plugin will detect if browser supports CSS3 animations than it will animate the element using CSS3 which will perform much better than animating using jQuery.
The pauseOnHover
also works using CSS3. The plugin just prepares the setup and required CSS3 animation CSS.
Due to some reasons if you want plugin to animate always using jQuery than you need to set allowCss3Support
option to false
. Also an extra option css3easing
is added.
Check demo page for example: http://aamirafridi.com/jquery/jquery-marquee-plugin#examples
Update (27 Nov 2013): Easing option added. Requires jQuery easing plugin.
Update (22 Nov 2013): Now plugin supports the 'up' and 'down' directions. Please have a look at the example to see how to use.
Update (21 Aug 2013):
If you want to hide the marquee for certain devices, try using visibility: hidden
with height: 0
& position: absolute
instead of display: none
because jQuery cannot calculate with width etc of hidden elements.
For more details:
Update (22 Feb 2013):
pauseOnHover
option added. Please note that you will need to include jQuery pause plugin: https://github.com/tobia/Pause before the jQuery Marquee plugin.
Update (20 Feb 2013):
FAQs
jQuery plugin to scroll the text like the old traditional marquee http://aamirafridi.com/jquery/jquery-marquee-plugin — Edit
The npm package jquery.marquee receives a total of 3,674 weekly downloads. As such, jquery.marquee popularity was classified as popular.
We found that jquery.marquee demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.