CSS Transition Not Firing

A cleaner approach that does not rely on setTimeout, is to read the css property in question before setting it: var div = $(‘<div />’).addClass(‘trans’); $(‘#container’).append(div); div.css(‘width’);//add this line div.css(‘width’, ‘200px’); Working here: var div = $(‘<div class=”trans” />’); $(‘#container’).append(div); var div = $(‘<div />’).addClass(‘trans’); $(‘#container’).append(div); div.css(‘width’);//add this line div.css(‘width’, ‘200px’); .trans { width: 20px; … Read more

Add transition while changing img src with javascript

You want a crossfade. Basically you need to position both images on top of each other, and set one’s opacity to 0 so that it will be hidden: <div id=”container”> <img class=”hidden image1″ src=”http://www.istockphoto.com/file_thumbview_approve/4629609/2/istockphoto_4629609-green-field.jpg”> <img class=”image2″ src=”http://www.istockphoto.com/file_thumbview_approve/9958532/2/istockphoto_9958532-sun-and-clouds.jpg” /> </div> CSS: .hidden{ opacity:0; } img{ position:absolute; opacity:1; transition:opacity 0.5s linear; } With a transition set for … Read more

Implement page curl on android?

I’m doing some experimenting on page curl effect on Android using OpenGL ES at the moment. It’s quite a sketch actually but maybe gives some idea how to implement page curl for your needs. If you’re interested in 3D page flip implementation that is. As for the formula you’re referring to – I tried it … Read more

overridePendingTransition does not work when FLAG_ACTIVITY_REORDER_TO_FRONT is used

Actually the right solution when using REORDER_TO_FRONT is to call overridePendingTransition in the method onNewIntent() of the activity you are going to open. @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } replace with your transitions. If you need to selectively replace the transition you can add an extra in your intent and check … Read more

JavaScript – add transition between display:none and display:block

@vothaison’s suggestion: CSS transitions Technically, @vothaison wanted to use setInterval as opposed to setTimeout, but I don’t see the need for that. It’s just more work. var hint = document.getElementById(‘hint’); var btn = document.getElementById(‘btn_show’); btn.addEventListener(‘click’, function(){ var ctr = 1; hint.className = hint.className !== ‘show’ ? ‘show’ : ‘hide’; if (hint.className === ‘show’) { hint.style.display … Read more