मैं एक div में पाठ के स्वैपिंग में देरी करने का प्रयास कर रहा हूं। यह पाठ के लिए एक स्लाइडर/कैरोसेल की तरह काम करना चाहिए।jQuery क्रियाओं के समय में देरी करने के लिए setTimeout का उपयोग
मेरे पास कोड गलत होना चाहिए, क्योंकि अंतिम पाठ प्रतिस्थापन कभी नहीं होता है।
इसके अलावा, मैं प्रतिस्थापन पाठ (उदाहरण के लिए विंडो अंधा,) को कैसे शुरू कर सकता हूं?
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
<script type="text/javascript">
$(document).ready(function() {
$("#showDiv").click(function() {
$('#theDiv').show(1000, function() {
setTimeout(function() {
$('#theDiv').html('Here is some replacement text', function() {
setTimeout(function() {
$('#theDiv').html('More replacement text goes here');
}, 2500);
});
}, 2500);
});
}); //click function ends
}); //END $(document).ready()
</script>
</head>
<body>
Below me is a DIV called "theDiv".<br><br>
<div id="theDiv" style="background-color:yellow;display:none;width:30%;margin:0 auto;">
This text is inside the Div called "theDiv".
</div><br>
<br>
<input type="button" id="showDiv" value="Show DIV">
</body>
</html>
सबसे उपयुक्त इसके लिए टूल '.queue() 'मुझे लगता है ... – Shikkediel