Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8606399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:05:05+00:00 2026-06-12T03:05:05+00:00

I have scoured the Internet far and wide and while I found this stackoverflow

  • 0

I have scoured the Internet far and wide and while I found this stackoverflow post insightful Is it possible to change the position of Bootstrap popovers based on screen width?, it still didn’t answer my question, likely due to my trouble understanding position/offset.

Here’s what I’m trying to do. I want the Twitter Bootstap Popover position to be RIGHT unless the hotspot popover will be positioned beyond the viewport, then I want it to be positioned LEFT. I’m making an iPad web app that has hot spots, when you push on a hotspot, information appears but I don’t want it to appear outside of the viewport when horizontal scrolling is locked.

I’m thinking it’d go something like this:

$('.infopoint').popover({
        trigger:'hover',
        animation: false,
        placement: wheretoplace 
    });
    function wheretoplace(){
        var myLeft = $(this).offset.left;

        if (myLeft<500) return 'left';
        return 'right';
    }

Thoughts? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:05:06+00:00Added an answer on June 12, 2026 at 3:05 am

    I just noticed that the placement option could either be a string or a function returning a string that makes the calculation each time you click on a popover-able link.

    This makes it real easy to replicate what you did without the initial $.each function:

    var options = {
        placement: function (context, source) {
            var position = $(source).position();
    
            if (position.left > 515) {
                return "left";
            }
    
            if (position.left < 515) {
                return "right";
            }
    
            if (position.top < 110){
                return "bottom";
            }
    
            return "top";
        }
        , trigger: "click"
    };
    $(".infopoint").popover(options);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have scoured for 2 hours now across the internet, I have found courses
I have scoured the internet for this answer, and I feel like I keep
I have scoured the internet looking for a solution to this and I am
I have scoured the internet looking for an answer to this question and can't
I have scoured the internet but can't find an answer to this : I'm
I have scoured the Internet for an answer to this. I have an array
I have scoured the internet to find which CMS's run on CloudSites and the
I've scored the internet for sources and have found a lot of useful information,
I have scoured Google for a tutorial to help with this but haven't been
I have scoured the net for this question and have came up empty handed.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.