Solved

How do I get a responsive image to work with AFFIX in Bootstrap 3?

Posted on 2014-01-12
5
1,108 Views
Last Modified: 2014-02-14
I have a responsive image that I'm trying to AFFIX when the user scrolls.  The image does AFFIX, but it loses it's responsiveness when data-spy="affix" is called.  Any idea how to fix this problem?  Here is the link:
http://therevolutionet.com/ION/BS3/affixMap.html
0
Comment
Question by:TrevorTomato
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39774898
Add a custom css using a media query to match bootstrap. Here I added a class called mapimg
@media (min-width: 768px) { 
.img-responsive.mapimg{
  max-width:400px;
  
 }

}

Open in new window

<div data-spy="affix" data-offset-top="60" data-offset-bottom="200">
     <img class="img-responsive mapimg" src="http://therevolutionet.com/ION/BS3/img/map_demo.jpg">
    </div>

Open in new window


I have a sample here http://jsbin.com/eZAKiDA/3/

You can see you should really change the max width for each of

970px and 1170px
@media (min-width: 970px) { 
.img-responsive.mapimg{
  /* play with width max-width:400px; */
  
 }

}
@media (min-width: 1170px) { 
.img-responsive.mapimg{
   /* play with width max-width:400px; */
  
 }

}

Open in new window

0
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39774904
This seems to work http://jsbin.com/eZAKiDA/3/


@media (min-width: 768px) { 
.img-responsive.mapimg{
  max-width:400px;
  
 }

}
@media (min-width: 970px) { 
.img-responsive.mapimg{
  max-width:350px;
  
 }

}
@media (min-width: 1170px) { 
.img-responsive.mapimg{
  max-width:450px;
  
 }

}

Open in new window

0
 

Author Comment

by:TrevorTomato
ID: 39774908
max-width fixed it!  Thanks Padas!
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question