Tuesday 15 June 2010

javascript - Controlling CSS Float with JQuery -


I'm writing something similar to jQuery UI accordion, but vertical. I'm working very well with this one exception. When you click on the third tab, it is skipped and shows the expected text, but it takes you to a place before the second tab. Make tab order 132 instead of 123. Number is correct in every other state.

Any ideas on stopping the float in the right order

I know about other vertical accordions, but it can be used, but JS is one of my weak areas, I learn I am doing this and for this.

I saved it on

my javascript code <("background color", "# 191970"); $ ("# 1"). CSS ("width $" ("# 5"); $ ("# 1") CSS ("float", "left"), $ ("# 2"). CSS ("background-color", "# 191970" Css ("width", "50px"); $ (css $ ("# 2"). $ ("Width", "50px"); $ ("# 3"). CSS ("float", "right"); $ ("# $ ( CSS ("float"). CSS ("width", "400px"); $ ("# boxman"). Text ($ ("click (function () {$ (" # 2 "). , "$ (" Float "," right "); $ (" # boxman ") effect. (" Highlight ", {Color: '# DDD'}, 900); $ (" # Boxmain "). Text ($ (" #onet ") text ()). CSS ("float", "left"), $ ("# 3"). CSS ("float", "right" $ ("# boxman"). Effect ("highlight", {color: '# ("Float", "left"), $ ("# 2"), $ ("# boxman"). $ ("# Twin"). Text ($ ("# twin"). Text ());}); ("(" Highlight ", {Color: '# DDD'}, 900); $ (" # boxman "). Text ($ (" # Sagittarius "). Text ());});});

I You can help make this very easy. There is a lot to read, but if you want you can work it already. You do not have to swap about floats, you can just swap about different containers. First, some CSS:

  .accordion {height: 200px; Swim left; Limit: #FFF concrete1px; Range radius: 10px 10px 10px 10px; White color; Width: 50px; Background: # 191970; } .boxman {width: 400px; Background: #ccc; }   

Then HTML-Notice how I organize it using the Addition Class:

    

Now script I have removed all the CSS statements because instead of doing it with CSS, I will explain the .click () method later. $ {$ ("P") $ ("P"). $ (" ); $ ("(# 1)" (function () {$ ("# boxmain"). InsertAfter (this); $ ("# boxmain") ($ ("# Onet"). Text ()); $ ("#", "#", "$" ("#", "$" ("# Boxmain"). $ ("# Boxman"). $ ("# Boxman"). Effect ("highlight", {color : $ ("#boxmain"), $ ("#boxmain"). Text ($ ("# twot"). Text ());}); $ ("# 3") Click (function () { $ ("# Boxmain"). InsertAfter (this $ ("# boxman"). Effects ("Highlight", {Color: '# DDD'}, 900); $ ("# boxman"). Text ($ (" # Sagittarius "). Text ());});});

Clicking method to reference that element A uses the concept of "this" which is running on click. In the case of $ ("# 1"). Click () $ (this) refers to # 1 Instead of trying to hang around, you can move the #boxmain element instead.

No comments:

Post a Comment