javascript - Creating a slide in div with jquery -
I am trying to create a div with 2 buttons. Click on the first button and one noter diva slide from the left. There is a button in it, when clicked, it slides back to the screen. For the second button in the main device only when the second button is clicked on the right side of a diva slides
This is done in all jquery.
Can anyone tell me what is wrong here?
jquery:
var boxwidth = $ ("# port2"). Width (); $ ('# Left'). On ('click', function () {$ ('# port1'). Animate ({left: '8'});}); $ ('Click', function () {$ ('# port2'). Animate ({(true: '100%' - boxwidth})}} $ ('# leftC') 'Click', function () {$ ('# port1'). Animate ({true: '100%'});}); $ ('# rightC'). ('Click', function) {$ ( '# Port2'). Chetan ({left: '100%'})}}
& lt; / div> css
#text {width: 500px; height: 200px; background-color : Red; font-weight: bold; font-size: 1.2mm; padding: 25px;} #text button {margin: 20px 0px 10px;} # port1 {width: 500px; Height: 200px; Background color: green; Font-weight: bold; Font-size: 1.2mm; Padding: 25px; Status: Absolute; Left: -100%} # port2 {width: 500px; Height: 200px; Background color: yellow; font-weight: bold; Font-size: 1.2em; Padding: 25px; Status: Completed; Correct: -100%; } Here you can see in action:
thanks
Please check this
The answer given by Anshu is failing when the right BTN is clicked a second time (The reason is right, left CSS conflict is my guess). <$ ('Left'). ($ '(' # Port1 '). $ (' Click ', function) # Port2'). RemoveAttr ('style'); $ ('# Port1') Animate ({left: '8'});}); $ ('#right') ('Click', function () {console.log ($ ('# port2'). CSS ('right') + 'right'); $ ('# port2'). Deletete ('style'); $ ( '# Port2'). Chetan ({true: '- 39px'});}); $ ('# LeftC') ('Click', function () {$ ('# port1'). Animate ({left: '- 532px'});}); $ ('#Com RightC') On ('click', function () {$ ('# port2'). Animate ({true: '- 52 9px'});});
Comments
Post a Comment