jQuery Tutorial for Beginners
Lesson 306 of 630 · optimize jquery progress bar · Database
optimize jquery progress bar
Link for all dot net and sql server video tutorial playlists
https://www.youtube.com/user/kudvenkat/playlists?sort=dd&view=1
Link for slides, code samples and text version of the video
http://csharp-video-tutorials.blogspot.com/2015/05/optimize-jquery-progress-bar.html
In this video we will discuss how to enhance and optimize the jquery progress bar that we created in Part 48 of jQuery tutorial.
At the moment the progress bar always counts from 1. For example
1. When you select 30%, it starts to count from 1 to 30 which is good.
2. Now if you select 70%, it starts again from 1 and counts all the way till 70, instead of continuing to count from 30 to 70.
The following code counts from the previous point. For example
1. If you select 30% first, it starts to count from 1 to 30. Now if you select 90, it counts from 30 to 90.
2. At this point, if you select 20%, it counts down from 90 to 20.
Replace < with LESSTHAN symbol and > with GREATERTHAN symbol
$(document).ready(function () {
var currentPercentage = 0;
var previousPercenage = 0;
$(‘#myButton’).click(function () {
previousPercenage = currentPercentage;
currentPercentage = $(‘#ddlPercent’).val();
animateProgressBar(previousPercenage, currentPercentage);
});
function animateProgressBar(previousPercenage, currentPercentage) {
$(‘#innerDiv’).animate({
‘width’: (500 * currentPercentage) / 100
}, 2000);
if (previousPercenage > currentPercentage)
currentPercentage = currentPercentage – 1;
$({ counter: previousPercenage }).animate({ counter: currentPercentage }, {
duration: 2000,
step: function () {
$(‘#innerDiv’).text(Math.ceil(this.counter) + ‘ %’);
}
});
}
});
The above code can be optimized as shown below. This optimization is suggested by Aptem A, one of our youtube subscribers. This is great, thanks to him for his valuable contribution.
$(document).ready(function () {
$(‘#myButton’).click(function () {
animateProgressBar($(‘#ddlPercent’).val());
});
function animateProgressBar(currentPercentage) {
$(“#innerDiv”).animate({ “width”: (currentPercentage * 500) / 100 }, {
duration: 3000,
step: function (now, fx) {
$(“#innerDiv”).text(Math.ceil((now / 500) * 100) + ‘ %’);
}
});
}
});
step option of the animate function can be used to define a function that gets called after each step of the animation. This method has 2 parameters – now & tween.
1. now – contains the value being animated
2. tween – is a complex object and contains several properties. A few are listed below. For the complete list set a break point and inspect the object
elem – The DOM element being animated
now – The value the animation is currently at
end – The value the animation will end at
jQuery animate method documentation
http://api.jquery.com/animate
- $.each jquery
- $.each vs .each
- $(document).ready vs $(window).load
- advantages of content delivery network
- advantages of jquery
- advantages of using jquery cdn
- ajax call wcf service json
- ajax consume wcf service
- ajax wcf call
- animate enlarge image jquery
- animate image hover
- animated jquery progress bar
- append vs appendto in jquery
- asp net c# suggest unique username
- asp net handler jquery progress indicator
- asp net handler jquery progressbar example
- asp net jquery drag and drop reorder
- asp net jquery sortable
- asp.net convert data to json
- asp.net convert json string to object
- asp.net convert json to object
- asp.net convert string to json
- asp.net file upload jquery progress bar
- asp.net jquery accordion database
- asp.net jquery accordion example
- asp.net jquery sortable list
- asp.net web service return json jquery
- aspnet ajax modal popup
- autocomplete textbox in asp net with database using jquery
- bind events jquery
- c# convert json string to class
- c# convert json string to object
- c# convert json to class
- c# convert json to object
- c# convert object to json
- c# convert object to json string
- c# generic handler return json
- call asp.net webmethod from jquery
- call code behind method from jquery
- case insensitive jquery selector
- change font size jquery
- change table row color jquery
- check if username exists in database asp.net
- check if username exists in database c#
- check if username is available
- check if username is available ajax
- check if username is taken
- check if username is taken ajax
- consuming wcf service using jquery
- convert .net object to json string
- convert javascript event to jquery
- convert javascript event to jquery event
- convert js event to jquery event
- convert json string to json array
- convert json string to json object array
- convert jsonarray to string
- convert string to json object
- create progress bar using jquery
- css class selector in jquery
- database driven jquery menu in asp.net
- decrease font size jquery
- difference between .each and jquery.each
- difference between $(window).load and $(document).ready
- difference between append and prepend in jquery
- difference between document load and ready
- difference between document.getelementbyid('id') and $('#id')
- difference between get and post
- difference between input and input jquery
- difference between jquery load and get
- difference document ready window load
- div always on top of screen
- document height vs window height
- document.ready function in jquery
- document.ready in jquery
- droppable hoverclass example
- event delegation using jquery
- file upload using jquery ajax and asp.net handler
- fixed div on scroll
- floating div using jquery example
- generic handler in asp.net c# example
- get vs post
- get vs post ajax
- hide ajax modal popup using jquery
- how method chaining work in jquery
- how to call asmx webservice from jquery
- how to call c# method using jquery
- how to call server side method using jquery
- how to check if a user has scrolled to the bottom
- how to get checkbox checked text in jquery
- how to get selected checkbox text in jquery
- how to prevent attaching event handler multiple times
- how to set alternate row color in html table using jquery
- html select element example
- http get vs post
- increase decrease font size on website
- increase font size jquery
- invoke wcf service using jquery
- javascript create json object example
- javascript json parse example
- javascript json parse string
- jquery ' attribute value ' case insensitive
- jquery # selector
- jquery # symbol
- jquery accordion asp.net repeater
- jquery accordion with asp.net listview
- jquery add event handler dynamically created element
- jquery add multiple attributes
- jquery addclass css transition
- jquery addclass example
- jquery after example
- jquery ajax call asmx web service
- jquery ajax call asp.net web service
- jquery ajax call asp.net webmethod
- jquery ajax example
- jquery ajax example asp.net
- jquery ajax example asp.net c#
- jquery ajax function
- jquery ajax function example
- jquery ajax get data server
- jquery ajax get example
- jquery ajax get function example
- jquery ajax json asp.net web service
- jquery ajax load complete event
- jquery ajax load error
- jquery ajax load html example
- jquery ajax load html page
- jquery ajax load html page into div
- jquery ajax load part of page
- jquery ajax load success error
- jquery ajax load vs get
- jquery ajax load xml
- jquery ajax load xml example
- jquery ajax modal popup
- jquery ajax post asp.net web service
- jquery ajax post example
- jquery ajax post json web service
- jquery ajax post webservice
- jQuery AJAX post() Method
- jquery ajax read xml
- jquery ajax read xml data
- jquery ajax read xml response
- jquery ajax save data
- jquery ajax tutorial
- jquery ajax tutorial for beginners
- jquery ajax username availability checker
- jquery ajax web service call json
- jquery always on top div
- jquery animate background color example
- jquery animate class change
- jquery animate color not working
- jquery animate css transition
- jquery animate font size example
- jquery animate function example
- jquery animate image position
- jquery animate image size
- jquery animate toggle class
- jquery animate transition between classes
- jquery animation
- jquery animation examples
- jquery animation fx queue
- jquery animation queue example
- jquery animation queue false
- jquery append example
- jquery append existing element
- jquery append html to existing element
- jquery appendto example
- jquery asp.net cascading dropdown
- jquery aspx code behind
- jquery attach event handler dynamically
- jquery attr function
- jquery attr function example
- jquery attr json
- jQuery attr method
- jquery attribute contains case insensitive
- jquery attribute contains prefix selector
- jquery attribute contains selector
- jquery attribute contains selector case insensitive
- jquery attribute contains word selector
- jquery attribute ends with selector
- jquery attribute equals selector
- jquery attribute not equal selector
- jquery attribute selector examples
- jquery attribute starts with selector
- jquery auto complete textbox with images in asp.net
- jquery auto load on scroll
- jquery autocomplete asp.net textbox
- jquery autocomplete c# asp net
- jquery autocomplete country flags
- jquery autocomplete database
- jquery autocomplete database example asp.net
- jquery autocomplete from database
- jquery autocomplete images in results
- jquery autocomplete in asp.net
- jquery autocomplete minlength
- jquery autocomplete source function
- jquery autocomplete source function callback
- jquery autocomplete textbox dropdown
- jquery autocomplete textbox from database
- jquery autocomplete textbox with asp.net web service
- jquery autocomplete textbox with images
- jquery autocomplete thumbnail
- jquery background color animate not working
- jquery background color animation
- jquery before element selector
- jquery before example
- jquery bind event
- jquery bind event handler
- jquery bind event to dynamically created element
- jquery bind function
- jquery bind method example
- jquery bind method to element
- jquery bind multiple events
- jquery bind multiple events to one element
- jquery bind multiple events to one function
- jquery bind multiple events to one handler
- jquery bind multiple events to same handler
- jquery button icon example
- jquery button widget example
- jquery buttonset widget
- jquery call json service
- jquery call json web service
- jquery call wcf service example
- jquery cascading dropdown asp.net
- jquery cascading dropdown database
- jquery cascading dropdown list in asp.net with example
- jquery cdn local fallback
- jquery chaining calls
- jquery chaining function calls
- jquery change event example
- jquery change multiple attributes
- jquery check if click event exists
- jquery check if click event is already bound
- jquery check if click event is bound
- jquery check if element hasclass
- jquery check if event handler already exists
- jquery check if event handler exists
- jquery check if event handler is registered
- jquery check if event handler is set
- jquery check mouse right click
- jquery checkbox button
- jquery checkbox change event example
- jquery checkbox get text
- jquery checkbox selected text
- jquery checkbox show password
- jquery click thumbnail change image
- jquery click thumbnail load image
- jquery click thumbnail show image
- jquery color animation
- jquery color animation not working
- jquery countdown progress bar example
- jquery css class animate
- jquery datatable column filter examples
- jquery datatable column filter in header
- jquery datatable column filter on top
- jquery datatable disable pagination
- jquery datatable disable sorting
- jquery datatable example
- jquery datatable format date column
- jquery datatable format hyperlink column
- jquery datatable height scroll
- jquery datatable hide search text box
- jquery datatable server side filter asp.net
- jquery datatable server side pagination asp.net
- jquery datatable server side sorting asp.net
- jquery datatable server side sorting example
- jquery datatable show hidden column
- jquery datatable vs datatable
- jquery datatables border
- jquery datatables column search
- jquery datatables copy to clipboard
- jquery datatables excel pdf
- jquery datatables export to csv
- jquery datatables export to excel
- jquery datatables get column visibility
- jquery datatables hide show columns
- jquery datatables individual column filtering example
- jquery datatables plugin example
- jquery datatables print button
- jquery datatables print view
- jquery datatables select menu
- jquery datatables server side processing asp.net
- jQuery datatables server-side processing using asp.net web services
- jquery datatables server-side processing using asp.net webforms
- jquery datatables set column visibility
- jquery datatables toggle column visibility
- jquery datepicker button
- jquery datepicker dropdown year
- jquery datepicker in asp.net example
- jquery datepicker localization
- jquery datepicker localization files
- jquery delegate click event
- jquery delegate click example
- jquery delegate event
- jquery delegate event handler
- jquery delegate example
- jQuery delegate function
- jquery delegate function example
- jquery delegate method
- jquery delegate selector
- jquery detect mouse right click
- jquery dialog open
- jquery dialog save data
- jquery dialog widget autoopen
- jquery dialog widget example
- jquery die function
- jquery difference between before and insertbefore
- jquery difference between insertafter and after
- jquery difference map each
- jquery disable browser right click menu
- jquery disable link
- jquery disable link click
- jquery disable link click event
- jquery drag drop sort update database
- jquery draggable always on top
- jquery draggable axis containment
- jquery draggable cancel drag
- jquery draggable clone droppable
- jquery draggable containment
- jquery draggable cursor
- jquery draggable div example
- jquery draggable helper example
- jquery draggable on top
- jquery draggable parent containment
- jquery draggable snap to element
- jquery draggable top problem
- jquery draggable widget example
- jquery draggable z-index
- jquery draggable z-index max
- jquery draggable z-index stack
- jquery draggable z-index top
- jquery dropdown change event example
- jquery droppable accept
- jquery droppable activate example
- jquery droppable activeclass
- jquery droppable drop event
- jquery droppable example
- jquery droppable out event
- jquery droppable over event
- jquery droppable return invalid
- jquery droppable revert after drop
- jquery dynamic menu json
- jquery dynamically created element onclick
- jquery dynamically created elements events
- jquery each break out
- jquery each example
- jquery each example function
- jquery each function break
- jquery each function example
- jquery each function exit
- jquery each function index
- jquery each function parameters
- jquery each function pass parameter
- jquery each function performance
- jquery each index
- jquery each index element
- jquery each json array
- jquery each map array
- jquery each vs map
- jQuery enabled selector
- jquery enlarge image on hover
- jquery enlarge image onclick
- jquery enlarge image onmouseover
- jquery event bubbling
- jquery event bubbling example
- jquery event bubbling explained
- jquery event delegation example
- jquery event delegation on
- jquery event handler dynamic element
- jquery event listener dynamic element
- jquery event object example
- jquery event object target
- jquery event target element type
- jquery event target tagname
- jquery event target type
- jquery examples
- jquery execute function one time
- jquery execute function only one time
- jquery exit map function
- jquery file upload progress bar asp net
- jquery find checkbox text
- jquery find selected checkboxes
- jquery floating div example
- jquery font size change
- jquery function chaining
- jquery fx queue
- jquery gallery thumbs
- jquery get all disabled inputs
- jquery get all selected checkboxes
- jquery get all selected option values
- jquery get attribute value
- jquery get change textarea value
- jquery get checkbox checked text
- jquery get checked checkbox value
- jquery get checked checkboxes values
- jquery get checked radio button value
- jquery get count of elements
- jquery get json from asp.net
- jquery get json from url
- jquery get multiple selected option
- jquery get multiple selected option text
- jquery get multiple selected option value
- jquery get multiselect values
- jquery get nested element by class
- jquery get selected checkboxes values
- jquery get selected option
- jquery get selected option text
- jquery get selected option text onchange
- jquery get selected option text value
- jquery get selected option value
- jquery get selected option value onchange
- jquery get selected radio button value
- jquery get total td count
- jquery hasclass example
- jquery hover effects
- jquery hover event
- jquery hover event example
- jquery hover function example
- jquery how to add class
- jquery how to add css class
- jquery how to remove a class
- jquery how to remove all classes
- jquery how to set css class
- jquery id selector example
- jquery image fade
- jquery image fade in
- jquery image fade out
- jquery image gallery animation
- jquery image gallery example
- jquery image gallery thumbs
- jquery image gallery tutorial
- jquery image gallery with thumbnails
- jquery image slider opacity
- jquery image slideshow
- jquery image slideshow example
- jquery image slideshow in asp.net
- jquery image slideshow tutorial
- jquery image slideshow with thumbnails
- jquery image slideshow with thumbs
- jquery image thumbnail gallery
- jquery image thumbs
- jquery implicit iteration
- jquery input password change type
- jquery input selector
- jquery input text selector
- jquery input type selector
- jquery input value selector
- jquery insert after element
- jquery insert before element
- jquery insertafter example
- jquery insertafter vs after
- jquery insertbefore example
- jquery insertbefore vs before
- jquery introduction
- jquery json parse example
- jquery live click function example
- jquery live die
- jquery live function alternative
- jquery live function deprecated
- jquery live function example
- jquery live function vs delegate
- jquery live method
- jquery live method and event bubbling
- jquery live method example
- jquery load callback function example
- jquery load callback function parameters
- jquery load json
- jquery load json into div
- jquery load vs get
- jquery loop thru json array
- jquery map break
- jquery map breakout
- jquery map each
- jquery map elements to array
- jquery map example
- jquery map exit
- jquery map function array
- jquery map function break
- jquery map function break out
- jquery map function example
- jquery map function to array
- jquery map function tutorial
- jquery map method vs each method
- jquery map vs each
- jquery mask unmask password
- jquery menu database driven
- jquery menu disable item
- jquery menu from database
- jquery menu from json
- jquery menu get selected item
- jquery menu icon
- jquery menu json data
- jquery menu widget examples
- jquery menu width
- jquery method chaining example
- jquery method chaining not working
- jquery middle mouse button click
- jquery modal dialog
- jquery modal dialog example
- jquery modal popup asp.net example
- jquery modal popup database
- jquery modal popup save to database
- jquery mouse x y position
- jquery mouseenter event
- jquery mouseenter example
- jquery mouseout
- jquery mouseout event
- jquery mouseout event example
- jquery mouseover event
- jquery mouseover event example
- jquery multiple animation queues
- jquery multiple animations
- jquery multiple animations on same element
- jquery multiple attribute json
- jquery multiple slider example
- jquery off function
- jquery off method
- jquery off method event
- jquery off method example
- jquery on function
- jquery on function example
- jquery on method
- jquery on method events
- jquery on method example
- jquery one function
- jquery one function example
- jquery one method
- jquery one method example
- jquery pass data to click
- jquery pass data to event handler
- jquery pass data to function
- jquery pass event data to function
- jquery pass event data using on function
- jquery pass event data using on method
- jquery passing event data
- jquery photo gallery
- jquery photo gallery animation
- jquery photo gallery with thumbnails
- jquery photo thumbnail gallery
- jquery post method
- jquery post method example
- jquery prepend element
- jquery prepend example
- jquery prepend function example
- jquery prepend to element
- jquery prevent browser default
- jquery prevent default link action
- jquery prevent link click
- jquery prevent link from opening
- jquery prevent right click
- jquery prevent right click menu
- jquery prevent right mouse click
- jquery preventdefault event
- jquery preventdefault example
- jquery preventdefault link
- jquery progress bar animate
- jquery progress bar countdown
- jquery progress bar display percentage
- jquery progress bar display value
- jquery progress bar file upload asp.net
- jquery progress bar percentage text
- jquery progress bar with percentage example
- jquery queue length
- jquery radio button change event
- jquery radio button change example
- jquery radio button widget
- jquery range slider example
- jquery range slider tutorial
- jquery reduce image size
- jquery remove 2 classes
- jquery remove all classes
- jquery remove all css classes
- jquery remove class animate
- jquery removeclass example
- jquery reorder questions in questionnaire
- jquery resizable autohide
- jquery resizable containment parent
- jquery resizable div
- jquery resizable handles
- jquery resizable maintain aspect ratio
- jquery resizable resize event
- jquery resizable restrict horizontal
- jquery resizable stop event
- jquery right mouse button click event
- jquery scroll event direction
- jquery scroll event example
- jquery scroll event handler
- jquery scroll event on div
- jquery select button icon
- jquery select change event
- jquery select change get value
- jquery select disabled elements
- jquery select element by attribute
- jquery select element by attribute data
- jquery select element by attribute name
- jquery select element by attribute value
- jquery select element by class
- jquery select element by more than one attribute
- jquery select element by multiple attribute value
- jquery select element with multiple attributes
- jquery select element with multiple css classes
- jquery select element with one attribute or another attribute
- jquery select element with two classes
- jquery select menu example
- jquery select nodes by class
- jquery selectable dynamic filter
- jquery selectable example
- jquery selectable filter example
- jquery selectable get selected value
- jquery selectable list
- jquery selectable list example
- jquery selectable list get value
- jquery selectable list items
- jquery selectmenu database
- jquery selectmenu in asp.net
- jquery selector attribute value case insensitive
- jquery selectors
- jquery selectors documentation
- jquery selectors tutorial
- jquery set attr json
- jquery set attribute value
- jquery set multiple attributes
- jquery set multiple attributes at once
- jquery show hide password checkbox
- jquery show password field
- jquery show password input
- jquery shrink image size
- jquery simple image gallery
- jquery simple image gallery tutorial
- jquery simple image gallery with thumbnails
- jquery slider change font size
- jquery slider example
- jquery slider increase decrease image height width
- jquery slider increase font size
- jquery sortable axis y
- jquery sortable connectwith example
- jquery sortable connectwith multiple lists
- jquery sortable connectwith one way
- jquery sortable filterable list
- jquery sortable placeholder example
- jquery sortable restrict axis
- jquery suggest unique username
- jquery tabs asp.net c#
- jquery tabs asp.net repeater
- jquery tabs example code in asp.net
- jquery textbox change event
- jquery textbox change event example
- jquery toggle show password
- jquery toggleclass animate
- jquery toggleclass example
- jquery toggleclass input
- jquery tooltip ajax content example
- jquery tooltip ajax loaded content
- jquery tooltip animation
- jquery tooltip content function
- jquery tooltip content function example
- jquery tooltip database content
- jquery tooltip example
- jquery tooltip plugin
- jquery tooltip track mouse
- jquery tooltip tutorial
- jquery tutorial
- jquery tutorial for beginners
- jquery ui accordion example asp.net
- jquery ui animate addclass
- jquery ui animate class transition
- jquery ui animate remove class
- jquery ui animate toggleclass
- jquery ui droppable deactivate
- jquery ui indeterminate progress bar
- jquery ui progress bar example
- jquery ui progress bar with text
- jquery ui range slider
- jquery ui range slider example
- jquery ui range slider tutorial
- jquery ui resizable animate
- jquery ui resizable containment
- jquery ui resizable ghost
- jquery ui resizable start
- jquery ui sortable connectwith
- jquery ui sortable opacity
- jquery ui submenu icon
- jquery ui tabs asp.net example
- jquery ui tooltip ajax content
- jquery unwrap element
- jquery unwrap example
- jquery wcf example
- jquery wcf json
- jquery wcf service
- jquery wcf service call example
- jquery webmethod
- jquery webmethod return json
- jquery which mouse button
- jquery which mouse button clicked
- jquery which mouse button pressed
- jquery wrap element contents
- jquery wrap elements in groups
- jquery wrap elements with same class
- jquery wrap function
- jquery wrap method
- jquery wrapall function
- jquery wrapinner example
- jquery wrapinner function
- jquery wrapinner method
- jqueryui draggable z index
- json array example
- json asp.net web services with jquery
- json example
- json example array
- json example javascript
- json object array
- json object array in javascript
- JSON Tutorial
- json.parse example
- json.stringify example
- load content while scrolling with jquery
- load data while scrolling page down with jquery
- loop through each table row jquery
- map function in jquery
- method chaining jquery
- modal popup using jquery in asp.net examples
- move div with page scroll
- nested json example
- nested json example javascript
- nested json objects
- nested json objects javascript
- page scroll load data jquery
- post data using jquery ajax
- prepend vs append jquery
- prepend vs prependto
- progress bar using jquery example
- pros and cons of cdn
- pros and cons of content delivery network
- range slider in jquery
- select optgroup example
- set the z order of jquery draggable
- show password checkbox jquery
- simple jquery accordion example
- simple jquery datatable example
- simple jquery image slideshow
- simple jquery progress bar example
- sql server stored procedure paging sorting filtering
- table alternate row color jquery
- table html with jquery
- tabs jquery example asp.net
- unbind jquery
- unbind jquery method
- unbind jquery mouseover
- use of $(document).ready(function()
- use of document.ready in jquery
- using jquery ajax json and asp.net web services
- using jquery ajax to call asmx web service methods
- using jquery ajax to call asp.net json web service
- what is cdn
- what is content delivery network
- what is jquery
- what is method chaining
- what is method chaining in jquery
- why use jquery
- window height and document height are the same
- window.height vs document.height
- xjquery range slider example in asp.net