2

I'm trying to create an app which on the second page when the slider is below 20% the .progress from the progress bar is pulsating and when the slider is 0% the whole .progressBar should pulsate.

I finally managed to make the code work on web on jsfiddle or in the ripple emulator but when I try to test it on the device it's all messed up. No pulsating effect appears or it appears but not in 0.5s interval as mentioned in the css or it flickers randomly or it fades out but not fully, just half of it....its like the effect happens but very fast or in contradiction to a similar effect... But I tried removing all the content from that page and still no luck...

Is it possible to make it work also on the mobile device?

UPDATE:

It's something with the pulsating effect because I tried to add the pulsating effect to all the elements on the page: the progress bar, the frame div, and to the 3 buttons and to the slider and the effect was very interesting: The frame, the progressBar and 2 of those 3 buttons were not really pulsating, just flickering. The other button wasn't doing anything, not even flickering, and the slider from the bottom was pulsating correctly (from 0 to 100% opacity and with 500ms delay).. What's the thing here? Why aren't other divs pulsating? Has it something with the position (fixed, absolute, relative)?? Is there a way to fix this or it's a bug? This all happens on the phone. On fiddle or on ripple emulator it works as it should! Why?

Could somebody please take a look at it... I'm having this problem for a few days so far and I cannot pass it. Thank you very much!

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Alex Stanese
  • 735
  • 4
  • 16
  • 33
  • Can anybody take a short look at this? Is it my code faulty or phonegap doesnt suppott the pulsating effect? – Alex Stanese Mar 07 '14 at 07:51
  • Can you post your fiddle? What device are you testing on? – net.uk.sweet Mar 08 '14 at 11:11
  • 1
    @net.uk.sweet My phone is galaxy s2 i9100. I made a fiddle http://jsfiddle.net/alecstheone/5q6wv/1/ but I cannot make it go to the second page... – Alex Stanese Mar 08 '14 at 11:41
  • @net.uk.sweet I also tried it on galaxy s2 mini and the same effect. But on i9100 eclipse emulator it works fine.. What could it be? – Alex Stanese Mar 08 '14 at 16:45
  • Please can anyone suggest me an option or workaround? I'm struggeling since weeks to solve this issue! – Alex Stanese Mar 09 '14 at 18:23
  • I cant explain myself why the pulsating effect works on some elements and on other dont.. This just on mobile becaus eon web it works perfectly on all... – Alex Stanese Mar 10 '14 at 22:47
  • Can you try reducing the code in your fiddle down so it only includes what's essential to demonstrate the issue? – net.uk.sweet Mar 10 '14 at 22:51
  • @net.uk.sweet it's pretty hard to implement the whole app in jsfiddle because it has alot of plugins.. If you want you can see the full app in my repo.. THe specific part with the progressBar is here http://jsfiddle.net/ezanker/D4UqU/13/ and as told it works. but on the device it doesnt. I noticed that if I try the pulsatin effect on multiple divs on the phone, some are pulsating correctly, some just flickering and some just doiong anything (all in the same page)... So I guess it's something with te pulsating effect. Can you please think of another workarounds or something to get that effect? – Alex Stanese Mar 11 '14 at 09:25

1 Answers1

1

Ok I have tested out the app and the jsFiddle on my device and got it working. By comparing the jsFiddle and your app in developer tools I identified certain differences in the CSS styling. Try adding a few lines to your CSS for .progress. Check this out:

.progress {
    position: absolute;
    box-sizing: border-box;
    box-shadow: inset 0px 0 5px 0 #777;
    -webkit-box-shadow: inset 0px 0 5px 0 #777;
    right: 0px;
    height: 100%;
/*     margin-top: 0px; */
    background-color: orange; 
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;   
    transition-duration: 0.5s, 0.5s;
    -webkit-transition-duration: 0.5s; /* for Safari */
    -webkit-transition-property: width, background;
    -webkit-transition-timing-function: ease-in-out, ease-in-out;
    transition-property: width, background;
    transition-timing-function: ease-in-out, ease-in-out;
    -webkit-transform: translateZ(0);
}

It is pulsing on my phone now. Try it out and let me know!

Also, check out this link that describes the page event order in jQuery Mobile.
http://www.gajotres.net/page-events-order-in-jquery-mobile/

You do not need to chain nest the page event functions inside the deviceready function.

Also, the progress bar continues to pulse even after I press the reset button, so I added this function to cancel the pulse animation on reset:

function cancelPulse(element) { 
    $(element || this).stop(true, false);
    var color = GetColorForVal(100);
    $("#slider .progress").css({"background": color, "width": (100) + "%", "opacity": 1});  
}
Ani
  • 566
  • 3
  • 4
  • can you please share the finished code? I cannot get it working. I dont have pageshow1 just pageshow 2 in the device ready function.. If I shrink down the device ready function and I add pageshow 1 function to the first page it doesn't execute the content from that function. I dont know, it's a mess. Is it really working with the pulsating effect correctly? (without flickr or fast animations) I cant beleave that..: ( – Alex Stanese Mar 11 '14 at 14:18
  • I'm talking about the index.js from the application because the js fiddle works for me and worked since at the beginning... The problem occured in the application on the device. – Alex Stanese Mar 11 '14 at 14:25
  • Check out the updated answer, I think it should work now. It wasn't pulsing before on my phone, but it definitely is now :) – Ani Mar 11 '14 at 15:04
  • I cannot beleave this, it has absolutely no sense to me, but anyway, it works... Your last code isn't working! What I did, I just hopelessly added -webkit-transform with the thought that its impossible to get myeffect on phone and thinking of the the next steps.. When I was totally shocked! Just by adding that line in the .progress and .progressBar solved my issue and now its fully 100% working as it should without lag, flickering or anything else. I cannot understand the process. If it was because the processing power, the other elements wouldn't pulsate as I told befose that I tested – Alex Stanese Mar 12 '14 at 18:34
  • Cool, glad it's working now. What I did to find the -webkit things was actually did developer tools on the jsfiddle page and developer tools on your site page. Focusing on the .progress while it is supposed to be animating I could see the opacity values changing, but the animation was not. Then I noticed that the jsFiddle had a bunch more -webkit lines so I added those to your css file and it worked. – Ani Mar 12 '14 at 18:38
  • on several divs. But anyway. Its working! Thank you very much for your more or less "accidental" line of cure!!! However may I ask you 2 more little questions? Could you please explain to me what is the cause of slightly moving my divs inside the pages weh I swich from one page to another? (with about 1-2px up and down)?And the second, why for example the first div wich is fading out isnt full screen? it has a white line on top (about 2-3px) and one on the bottom of the page(1 px). If you can explain that rationally to my youre a truly God in this domain. I gave up on those long time ago. – Alex Stanese Mar 12 '14 at 18:41
  • but as I told, the css lines you added wasn't helpfull at all. They didn't change anything.. The treasure was in this magnific line: -webkit-transform: translateZ(0); Was this also mentioned in the developer tools? – Alex Stanese Mar 12 '14 at 18:43
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/49593/discussion-between-alex-stanese-and-ani) – Alex Stanese Mar 12 '14 at 18:44