A div superimposed on an image descends according to the scroll bar

Asked

Viewed 333 times

0

2 answers

0

To place a div q accompany the bar, you must set it with position: Fixed; so the top point: x or bottom: x of css, will be fixed, even when scroll down.

0


My friend, I took a look at your code. At first I saw that they had some " id " equal, I advise you to use a class (also changing the css):

File touchTouch.jquery.js

$('<div class="dadosRoupa">').html(text);

Another thing I noticed was that I came down because of this code here:

var $spanInPlace = target.find("div"),
            $targetImage = target.find('img'),
            distanceBot  = target.height() - $targetImage.offset().top - $targetImage.height();

        $spanInPlace.css({"bottom": distanceBot+"px"});

I would change to:

   $spanInPlace.css({"bottom": "0px"});

So always take the same position.

I hope I’ve helped.

  • Thank you... gave it right !! 0

  • You’re welcome to give an OK on the answer. Thanks.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.