[ 4 posts ]

Divya

  • Username: divya-y
  • Joined: Tue Sep 25, 2012 8:08 pm
  • Posts: 22
  • Offline
  • Profile

Set focus on a particular blinking div

Post Posted: Thu Oct 04, 2012 3:16 am
+0-
Hi all,
when the page loads am gonna make particular div blinking. at the same time i want to set focus on that div.

YUI().use("node","anim", function(Y)
{
var node=Y.one("#id");
node.focus();
var anim = new Y.Anim({
node: node,
from: {
backgroundColor:"#FFFFFF"
},

to: {
backgroundColor:"#333333"

},

duration:0.5,
iterations: "infinite",
direction: "alternate"
});

anim.run();
node.focus()

});
node.focus() not working..
please help me on the same.

Alberto Santini

YUI Contributor

  • Offline
  • Profile

Re: Set focus on a particular blinking div

Post Posted: Thu Oct 04, 2012 6:00 am
+0-
Hello Divya.

I think you need to use tabindex attribute because it is not an input element, so the concept of focus is quite weak.

If I understood correctly the question this is a working example:
http://jsfiddle.net/qZaJK/1/

Press tab and you see the focus changing (with Chrome you see a yellow border).

Another way to interpret your question is about scrolling: scrolling until that div is displayed. In this case scrollIntoView may help you.

Hope that helps,
IceBox

P.S.: Next time it would be better to play with a jsfiddle snippet and I think animation is not relevant.

Divya

  • Username: divya-y
  • Joined: Tue Sep 25, 2012 8:08 pm
  • Posts: 22
  • Offline
  • Profile

Re: Set focus on a particular blinking div

Post Posted: Thu Oct 04, 2012 9:55 pm
+0-
thank you Alberto :) :) ..

Divya

  • Username: divya-y
  • Joined: Tue Sep 25, 2012 8:08 pm
  • Posts: 22
  • Offline
  • Profile

Re: Set focus on a particular blinking div

Post Posted: Thu Oct 04, 2012 10:09 pm
+0-
Thank you :) :)..it s working..
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum