Can't switch right to left jQuery

I have two icons (Glyphicon) which are places like

1: Menu to the left of the screen 2: Gift to the right of the screen.

When the button is pressed Menu

, a message appears with Left to Right

. This works great. But when clicked, Gift

it appears in some weird position as shown in the image named Suraj Palwe

This to the left of the image. I want this to appear to the right of the screen to move left according to the width div

.

This is the image as it looks. ImageJSfiddle

This is what I wrote in my code

style

.slide_birthday_click{
          margin-top: 2%;
          padding: 5px;

          background: grey;
          height: auto;
          display:none;
          position:absolute;
          z-index: 5;
          float: right;
        }

      

in html body

<div class="slide_birthday_click">
        <table class="table">
          <tr>
            <td>Suraj Palwe</td>
          </tr>
        </table>
    </div>
<span class="glyphicon glyphicon-gift" style="float:right;" id="today_birthdays"></span>

      

The Jquery Part

$("#today_birthdays").click(function(){
        $(".slide_birthday_click").toggle("slide",{direction:'right'},2000);
      });

      

I want this block to contain the word to the Suraj Palwe

right of the screen when it switches from right to left

.

This is the snap shot of js fiddle

I don't understand where I am going wrong in my code . Thanks in advance!

+3


source to share


2 answers


Ok So I solved my problem. There was nothing in it!

Just added to the right: 0; to css file

.slide_birthday_click{
      margin-top: 2%;
      padding: 5px;
      background: grey;
      height: auto;
      display:none;
      position:absolute;
      z-index: 5;
      float: right;
      right: 0;
    }

      



Thanks everyone!

This is a link to JS Fiddle answer

+1


source


Try:



$("#today_birthdays").delay(200).show("slide", { direction: "right" }, 1500);

      

+3


source







All Articles