Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10

Thread: JS Progress Bar

  • Thread Tools
  • Rate This Thread
  1. #1
    Regular Coder
    Join Date
    Feb 2014
    Posts
    406
    Thanks
    70
    Thanked 0 Times in 0 Posts

    JS Progress Bar

    Hello

    With the Circular Progress JS Progress 'Bar' here 24 Free jQuery CSS3 Progress Bar Codes

    there doesn't seem to be any CSS file, so I was wondering how I may position it on my page?

    Would that be done in one of the accompanying JS files? Sorry, I know next to nothing about JS, but I can post the JS files?

    I would also like to be able to make it invisible when not in use and visible when the user has clicked on the 'File Upload' button.

    Thank you.

  2. #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    9,808
    Thanks
    6
    Thanked 1,159 Times in 1,130 Posts
    Which of these progress meters are you using? I downloaded the first one and get an archive with a couple o’ files, including CSS.

  3. #3
    Regular Coder
    Join Date
    Feb 2014
    Posts
    406
    Thanks
    70
    Thanked 0 Times in 0 Posts
    It's not the first one, Stephan

    It's half-way down the page called Circular Progress JS Progress.

    You should see 3 circles of varying radii

    I downloaded the zip but no CSS in there.

    Thank you for replying.

  4. #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    9,808
    Thanks
    6
    Thanked 1,159 Times in 1,130 Posts
    Oh, OK, you mean this one, right? Apparently this script creates a canvas element. The example on that repository shows the progress meter being added to the body element. You can then add your CSS to position that element accordingly, like canvas {position: absolute; …}; the browser’s developer tools help you analyze the source code.

    However, the progress meter is just a visual effect. In order to actually show the progress of a file upload you need to combine that with an AJAX script that actually returns the status of the file upload and then sets the progress meter’s status/progress accordingly.

  5. #5
    Regular Coder
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    311
    Thanks
    0
    Thanked 42 Times in 40 Posts
    Quote Originally Posted by VIPStephan View Post
    However, the progress meter is just a visual effect. In order to actually show the progress of a file upload you need to combine that with an AJAX script that actually returns the status of the file upload and then sets the progress meter’s status/progress accordingly.
    Which IE10/earlier cannot report the progress of an AJAX transaction, and IE9/earlier cannot upload files via AJAX, which is why generally you do NOT see attempts at using scripting to handle uploads in the first place... though this is a pretty good article on the topic of getting it working:
    Uploading Files with AJAX - Treehouse Blog

    From there you just have to hook onto the load progress which may or may not work.

    Though done 'properly' you'd write the page to upload the file normally via a pageload, then enhance the page with scripting if possible with AJAX.

    ... which is WAY more complex than said canvas based (and therein only IE9/newer compatible) progress bar... one that could probably be replicated in less code and faster rendering without using canvas if you know what you are doing...
    From time to time the accessibility of websites must be refreshed with the blood of designers and owners; it is its natural manure.
    http://www.cutcodedown.com

  6. #6
    Regular Coder
    Join Date
    Feb 2014
    Posts
    406
    Thanks
    70
    Thanked 0 Times in 0 Posts
    Yes, that's the one.

    The 'file upload' page is here: User page

    and I was simply proposing to replace that upload bar with the more creative JS circles. Clever, isn't it?

    The actual 'trigger' event that shows a file being uploaded against its percentages, will be done in ASP.NET. I was concerned here only about the visual display of the circles.

    So I would have something like:

    <body>

    <div class="canvas">

    HTML

    </div>

    and in my CSS the various attributes such as positioning, colour, etc?

    Can I ask why have you selected 'canvas'?

    Thanks.

  7. #7
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    9,808
    Thanks
    6
    Thanked 1,159 Times in 1,130 Posts
    I haven’t “selected” canvas, the script is creating a canvas to display the progress. Look at line 41 of the code on https://github.com/neoziro/circular-...ar-progress.js. It creates a canvas and you insert it wherever you want eventually (the example on https://github.com/neoziro/circular-progress inserts it into the document body but you could insert is anywhere, really (e. g. have a div with ID “example” and do document.getElementById('example').appendChild(progress.el);)).

    Use your browser’s web developer tools (or Firebug) to analyze the HTML source and see that there is a canvas element. Any HTML you see in the web developer panel you can style with CSS. That’s why I said you would style the canvas element.

  8. Users who have thanked VIPStephan for this post:

    Blue1 (03-24-2016)

  9. #8
    Regular Coder
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    311
    Thanks
    0
    Thanked 42 Times in 40 Posts
    Quote Originally Posted by Blue1 View Post
    Clever, isn't it?
    Can't tell, doesn't work here... and being the typical train wreck of jQuery nonsense I'd be shocked if it works anywhere -- and that's BEFORE we talk about the accessibility disaster the site itself is.

    Massive static CSS in the markup, static scripting in the markup, hordes of off the shelf scripts for christmas only knows what, no media targets on the stylesheet, oddball form structure, what looks like information that shouldn't be passed client-side being passed client-side, span doing label's job (laughably with class="label" on it?!?), scripting only elements in the markup, trapping onclick for no reason, using the various onevent attributes instead of attaching to the markup, polluting the global namespace, trying to pass values from locations (like those onevent attributes) where values shouldn't be trusted, broken layout at large fonts/120dpi since you're using px metric instead of elastic containers around dynamic fonts, accessibility woes from being a fixed layout...

    Hence the ridiculous total file size and file count... in particular the 146k in external scripts on top of half the markup being scripting doing the job of one external file that I doubt given your current aim for functionality should exceed 16k... with the markup being reduced to around 2k from its current ridiculous 11k.

    Though a LOT of what you have there is entirely inline with what I expect to be vomited up as a form when ASP is involved -- not your fault, it's a rubbish tool for server side programming as evidenced by the ridiculous repeating of values, massive number of bizzaroland hidden inputs, lack of anything resembling semantic markup or logical document order, yadda, yadda, yadda.

    There is really little legitimate reason for what you have there to have much more than this:

    Code:
    <!DOCTYPE html><html lang="en"><head><meta charset="utf-8">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">
    <link rel="stylesheet" href="screen.css" media="screen,projection,tv">
    <title>Dima Dayoub</title>
    </head><body>
    
    <div id="top">
    
    	<h1><a href="/">Dima <span>Dayoub</span></a></h1>
    	<span class="date">15 March, 2016</span>
    
    	<div class="galleryAndFiles">
    
    		<hr>
    
    		<div class="gallery" data-gallery-update="300ms">
    			<img src="images/1.jpg" alt="photo_one" width="450" height="450">
    			<img src="images/2.jpg" alt="photo_two" width="450" height="450">
    			<img src="images/3.jpg" alt="photo_three" width="450" height="450">
    			<img src="images/4.jpg" alt="photo_four" width="450" height="450">
    			<img src="images/5.jpg" alt="photo_five" width="450" height="450">
    			<img src="images/6.jpg" alt="photo_six" width="450" height="450">
    			<img src="images/7.jpg" alt="photo_seven" width="450" height="450">
    			<img src="images/8.jpg" alt="photo_eight" width="450" height="450">
    			<img src="images/9.jpg" alt="photo_nine" width="450" height="450">
    			<img src="images/10.jpg" alt="photo_ten" width="450" height="450">
    		<!-- .gallery --></div>
    
    		<hr>
    
    		<form
    			method="post"
    			action="userpage.aspx"
    			id="fileUpload"
    			enctype="multipart/form-data"
    			data-upload-type="progress"
    		>
    			<fieldset>
    				<label for="fileUpload">Please upload your file(s)</label><br>
    				<input type="file" name="fileUpload" id="fileUpload"><br>
    			</fieldset>
    			<div class="submitsAndHiddens">
    				<input type="submit" value="upload">
    				<a href="logout">Logout</a>
    				<input type="hidden" name="hash" value="random hash here">
    			<!-- .submistAndHiddens --></div>
    		</form>
    
    	<!-- .galleryAndFiles --></div>
    
    	<hr>
    
    	<div id="footer">
    		&copy; 2015 Dima Dayoub, All Rights Reserved
    	 <!-- #footer --></div>
    
    <!-- #top --></div>
    
    <script src="library.js"></script>
    
    </body></html>
    As the markup. EVERYTHING else being done there belongs either in the SINGLE scripting include or SINGLE stylesheet -- with the jQuery bloated rubbish kicked to the curb.

    Quote Originally Posted by Blue1 View Post
    Can I ask why have you selected 'canvas'?
    YOU selected canvas when you chose that progress script, which is why the title of that place you linked to is misleading as that progress script has jack-all to do with CSS3. What's being done COULD be done with 3's assistance, but that script chose to use canvas instead, so that's why you have to target a canvas element.

    If I have time later I may take a few moments to do a rewrite of that page to show what I mean as a working demo of what you are intending/trying to do. You've actually got a pretty simple page as such things go, so it shouldn't take too long to toss together should another nasty bout of insomnia set in. I'm on a host of painkillers right now that's screwing up my non-24, so **** knows when I'm awake these days.
    From time to time the accessibility of websites must be refreshed with the blood of designers and owners; it is its natural manure.
    http://www.cutcodedown.com

  10. #9
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    9,808
    Thanks
    6
    Thanked 1,159 Times in 1,130 Posts
    Quote Originally Posted by deathshadow View Post
    I'm on a host of painkillers right now that's screwing up my non-24, so **** knows when I'm awake these days.
    Plus, I heard Stephen Colbert rant about you having switched to daylight savings time already (and he must be sharing your pain).

  11. #10
    Regular Coder
    Join Date
    Feb 2014
    Posts
    406
    Thanks
    70
    Thanked 0 Times in 0 Posts
    Many thanks for your reply and apologies or not posting back earlier.

    I'll take your advice and see how I get on.

    Cheers


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •