fade

Pure JavaScript fade in function

↘锁芯ラ 提交于 2019-11-27 04:40:24
Hi friends i want to fade in a div when i click on another div and for that i am using following code. Code1 works fine but i require to use the Code2 . I know there is jQuery but i require to do this in JavaScript Can you guide me that what kind of mistake i am doing or what i need change... Code1 --- Works Fine function starter() { fin(); } function fin() { for (i = 0; i <= 1; i += 0.01) { i=Math.round(i*100)/100; setTimeout("seto(" + i + ")", i * 1000); } } function seto(opa) { var ele = document.getElementById("div1"); ele.style.opacity = opa; } Code2 --- Does not work function starter() {

Fade Effect on Link Hover?

不羁岁月 提交于 2019-11-26 23:52:37
问题 on many sites, such as http://www.clearleft.com, you'll notice that when the links are hovered over, they will fade into a different color as opposed to immediately switching, the default action. I assume JavaScript is used to create this effect, does anyone know how? 回答1: Nowadays people are just using CSS3 transitions because it's a lot easier than messing with JS, browser support is reasonably good and it's merely cosmetic so it doesn't matter if it doesn't work. Something like this gets

Can I change the Android startActivity() transition animation?

狂风中的少年 提交于 2019-11-26 23:45:10
I am starting an activity and would rather have a alpha fade-in for startActivity() , and a fade-out for the finish() . How can I go about this in the Android SDK? Curtain In the same statement in which you execute finish(), execute your animation there too. Then, in the new activity, run another animation. See this code: fadein.xml <set xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true"> <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="500"/> //Time in milliseconds </set> In your finish-class private void finishTask() { if("blabbla"

Simple fade in fade out div with jquery on click

拥有回忆 提交于 2019-11-26 23:10:07
问题 THIS CODE UNDER HERE WORKS, you can read the answers under here - i edit this for future reference. HTML : <div><a href="#" id="btn">Show bank div and hide fancy div</a></div> <div id="btn-bk"><a href="#">back</a></div> <div id="bank">Bank Div</div> <div id="fancy">Fancy Div</div> CSS : #bank {display:none;} #btn-bk {display:none;} Javascript : $('#btn').click(function(e){ $('#fancy, #btn').fadeOut('slow', function(){ $('#bank, #btn-bk').fadeIn('slow'); }); }); $('#btn-bk').click(function(e){

Fade edges of UITableView

情到浓时终转凉″ 提交于 2019-11-26 20:29:22
问题 I've made a little research about my problem and unfortunately there was no solution for my problem. The closest was Fade UIImageView as it approaches the edges of a UIScrollView but it's still not for me. I want my table to apply an "invisibility gradient" on the top. If the cell is at a 50px distance from the top edge it starts to vanish. The closer it is to the upper edge, the more invisible the part is. The cells height is about 200 pixels, so the lower part of the cell need to be visible

How to fade changing background image

半城伤御伤魂 提交于 2019-11-26 19:52:47
I want to fade the images when I do this code: $("#large-img").css('background-image', 'url('+$img+')'); I've tried putting fade in so many places. Thanks This is probably what you wanted: $('#elem').fadeTo('slow', 0.3, function() { $(this).css('background-image', 'url(' + $img + ')'); }).fadeTo('slow', 1); With a 1 second delay: $('#elem').fadeTo('slow', 0.3, function() { $(this).css('background-image', 'url(' + $img + ')'); }).delay(1000).fadeTo('slow', 1); Rampant Creative Group Can I offer an alternative solution? I had this same issue, and fade didn't work because it faded the entire

Div opacity based on scrollbar position

折月煮酒 提交于 2019-11-26 17:43:47
问题 Find an example of how to fade out a div when the scroll bar reaches a certain position here. But it's not a smooth throttle-type fade. Here is the code from that jsfiddle: var divs = $('.social, .title'); $(window).scroll(function(){ if($(window).scrollTop()<10){ divs.fadeIn("fast"); } else { divs.fadeOut("fast"); } });​ I want the opacity percentage to to reflect the position of the scrollbar. For instance when the scroll bar is at very top position, the div opacity is 100%. When I scroll

过渡模式

瘦欲@ 提交于 2019-11-26 16:47:07
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <script src="vue.js"></script> </head> <body> <div> <h1>--过渡模式(进入和离开同时发生)--</h1> <div id="example1"> <transition name="no-mode-fade"> <!--当有相同标签名的元素切换时,需要通过 key 特性 设置唯一的值来标记以让 Vue 区分它们,否则 Vue 为了 效率只会替换相同标签内部的内容--> <button v-if="on" key="on" @click="on = false"> on </button> <button v-else="" key="off" @click="on = true"> off </button> </transition> </div> <script> var example1 = new Vue({ el: '#example1', data: { on: false }, }) </script> <style> .no-mode-fade-enter-active, .no-mode-fade-leave-active { transition: opacity .5s } .no-mode

Determine coordinates of a UITableViewCell while scrolling

≯℡__Kan透↙ 提交于 2019-11-26 15:55:47
问题 My goal is to have the UITableViewCells fade in/out when they are approaching the bounds of the UITableView and about to be covered/revealed. The approach I have been trying is to get the coordinates of the UITableViewCell during a scroll event. The problem is that every cell seems to be at 0,0. I have tried converting the coordinates to the parent table and view, but they still come out at 0,0. So in general, if anyone knows a way to get the coordinates, or of a better way to go about fading

How to fade to display: inline-block

谁说胖子不能爱 提交于 2019-11-26 14:29:56
In my page I have a bunch (about 30) dom nodes that should be added invisible, and fade in when they are fully loaded. The elements need a display: inline-block style. I would like to use the jquery .fadeIn() function. This requires that the element initially has a display: none; rule to initially hide it. After the fadeIn() the elements off course have the default display: inherit; How can I use the fade functionality with a display value other than inherit? You could use jQuery's animate function to change the opacity yourself, leaving the display unaffected. $("div").fadeIn().css("display",