Hey Frosticek
thanks for pointing out my misunderstanding. i had a time of it trying to find a js way of holding back the load of progressbar until all required elements where selected/inputted. i decided to have a look for a jquery progress bar and came across this little beauty
http://workshop.rs/2012/12/animated-progress-bar-in-4-lines-of-jquery/.
the only problem i can see with this, is when "Ask the Seller" is selected the progress bar does not load. do you have any ideas?
Heres is the code.
this code is set for required category, price, country, region, city, address. if you dont required these things on you publish and edit pages then remove or even add to what suits you
if($("#catId").val() && $("#price").val() && $("#countryId").val() && $("#regionId").val() && $("#cityId").val() && $("#address").val() )
first find this on item-edit.php
<button type="submit" id="blue"><?php _e('Save changes', 'patricia'); ?></button>
Replace with this
<button type="submit" onclick="progress(100, $('#progressBar'))" id="blue"><?php _e('Save changes', 'patricia'); ?></button>
<div id="progressBar"><div></div></div>
add this the bottom of item-edit.php before <?php osc_current_web_theme_path('footer.php') ; ?>
increase/decrease the number 2000 to change load time for progress bar
<script>
function progress(percent, $element) {
if($("#catId").val() && $("#price").val() && $("#countryId").val() && $("#regionId").val() && $("#cityId").val() && $("#address").val() ) {
var progressBarWidth = percent * $element.width() / 100;
$element.find('div').animate({ width: progressBarWidth }, 2000).html(percent + "% ");
}
}
</script>
now open item-post.php and find this
<button type="submit" id="blue"><?php _e('Publish item', 'patricia'); ?></button>
replace with this
<button type="submit" onclick="progress(100, $('#progressBar'));" id="blue"><?php _e('Publish item', 'patricia'); ?></button>
<div id="progressBar"><div></div></div>
add this to the bottom of item-post.php just before <?php osc_current_web_theme_path('footer.php') ; ?>
increase/decrease the number 2000 to change load time for progress bar
<script>
function progress(percent, $element) {
if($("#catId").val() && $("#price").val() && $("#countryId").val() && $("#regionId").val() && $("#cityId").val() && $("#address").val() ) {
var progressBarWidth = percent * $element.width() / 100;
$element.find('div').animate({ width: progressBarWidth }, 2000).html(percent + "% ");
}
}
</script>
finally add the css to you style
/* ITEM ADD/EDIT PROGRESS LOADING */
#progressBar {display: inline-block;width: 40%;max-width:250px;margin:30px 0 0 10px;height: 30px;border: 1px solid #bbb;background-color: #efefef;}
#progressBar div {height: 100%;color: #4CAF50;text-align: center;line-height: 30px;width: 0;background-color: #4CAF50;}
one last thing. it looks like the percentage is supposed to count as the bar loads but i can't get it to display. so i have coloured the percent number the same as the bar. its not really need as long as the user can see a progress when the bar loads.
Thanks Frosticek yet again