Create a gist now

Instantly share code, notes, and snippets.

jQuery.sub examples
<!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>
(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()));
<!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>
(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));
@lukemorton
Owner

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

@nakataaaa

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