0

I am trying to change the bootstrap popover data-placement from bottom to left in jquery based on screen width.

<img src="images/user.svg" id="usericon" data-toggle="popover" data-placement="bottom" data-content="">

Jquery:

if ($(window).width() < 480) {
    $('[data-toggle="popover"]').popover({content: htmlcont,data-placement: left, html: true});
    } else {
    $('[data-toggle="popover"]').popover({content: htmlcont, html: true});
    }

not working for me...how can i do this?

CJAY
  • 6,989
  • 18
  • 64
  • 106

1 Answers1

2

Use placement instead of data-placement

if ($(window).width() < 480) {
    $('[data-toggle="popover"]').popover({content: htmlcont,placement: left, html: true});
    } else {
    $('[data-toggle="popover"]').popover({content: htmlcont, html: true});
    }

That is the property name they use for the options

Also, see Changing the position of Bootstrap popovers based on the popover's X position in relation to window edge?

Community
  • 1
  • 1
AmmarCSE
  • 30,079
  • 5
  • 45
  • 53