Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

jQuery.sub examples

View with-jquery.sub.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
<!doctype html>
<html>
<head>
<title>Testing jQuery.sub()</title>
</head>
<body>
<div class="example">Testing</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script src="with-jquery.sub.js"></script>
<script>
jQuery(function ($) {
$('.example')
.fadeOut()
.delay(1000) // Does not append paragraph
.fadeIn()
.myPlugin()
.fadeOut()
.delay(1001) // Does append paragraph
.fadeIn();
$('.example')
.fadeOut()
.delay(1002) // Does not append paragraph still
.fadeIn();
});
</script>
</body>
</html>
View with-jquery.sub.html
1 2 3 4 5 6 7 8 9 10 11 12
(function ($, myPlugin) {
myPlugin.fn.delay = function (delay, queueName) {
$('body').append('<p>Delaying for ' + delay + '</p>');
return $.fn.delay.call(this, delay, queueName);
};
$.fn.myPlugin = function () {
return myPlugin(this);
};
}(jQuery, jQuery.sub()));
View with-jquery.sub.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
<!doctype html>
<html>
<head>
<title>Testing jQuery.sub()</title>
</head>
<body>
<div class="example">Testing</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script src="without-jquery.sub.js"></script>
<script>
jQuery(function ($) {
$('.example')
.fadeOut()
.delay(1000) // Does not append paragraph
.fadeIn()
.myPlugin()
.fadeOut()
.delay(1001) // Does append paragraph
.fadeIn();
$('.example')
.fadeOut()
.delay(1002) // Does not append paragraph still
.fadeIn();
});
</script>
</body>
</html>
View with-jquery.sub.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14
(function ($) {
$.fn.myPlugin = function () {
this.delay = function (delay, queueName) {
$('body').append('<p>Delaying for ' + delay + '</p>');
return $.fn.delay.call(this, delay, queueName);
};
return this;
};
}(jQuery));

Isn't using jQuery.sub() just over complicating matters? I'm not sure I see the benefits in this particular instance.

hello,
i'm trying to mix a video whit subtitles in a wamp server i dont knwo what im doing wrong....cause it simples play the video but srt file misse...
Do u have any kind of example, tutorial or something to help me out?

Chears from portugal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.