WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Background Image – Fixed Position (non-scrolling) is being ignored

[Resolved] Background Image – Fixed Position (non-scrolling) is being ignored

Viewing 11 replies - 1 through 11 (of 11 total)
  • I’m continuing to look but running out of ideas. It seems that the mobile theme functions.php file is importing some, but not all, of the settings from the full/parent theme and this causes the Jetpack Custom CSS to be ignored. I can’t figure out a way around it through.

    Plugin Contributor Richard Archambault

    @richardmtl

    Happiness Engineer

    Hi! Did you manage to fix this? It looks ok to me right now, but maybe I am misunderstanding the problem.

    Plugin Contributor Richard Archambault

    @richardmtl

    Happiness Engineer

    Hi! Did you manage to fix this? It looks ok to me right now, but maybe I am misunderstanding the problem.

    Hi Richard. Thanks for your reply.

    Sorry, I deactivated the mobile theme over the weekend for testing and I just turned it back on. The background still scrolls and I can’t figure out why.

    This is what shows up in the page source, despite my efforts to make it otherwise:

    <style type="text/css">
    body {background-color: #000000; background-image: url('http://carltonbale.com/wp-content/uploads/2014/04/home_theater_background_30.jpg'); background-repeat: no-repeat; background-position: top center; background-attachment: scroll;			}
    				#page,
    		#branding {
    			margin: 0.6em 0.6em 0.8em;
    		}
    		#site-generator {
    			border: 0;
    		}
    			/* If The user has set a header text color, use that */
    		#site-title,
    		#site-title a {
    			color: #ffffff;
    			}
    	</style>

    Thanks for any suggestions.

    Plugin Contributor Richard Archambault

    @richardmtl

    Happiness Engineer

    Hi!

    Again, the Mobile theme doesn’t appear to be active. Where and how are you inputting that CSS?

    Hi Richard. The mobile theme is definitely active. I disabled caching to make sure it loads and it appears to be switching between the 2 versions now without issue.

    I set the background imaged to “fixed” in two locations: 1) the main theme settings and also in 2) the Jetpack Custom CSS plugin. When I make other CSS changes in either of these places, they propagate to the mobile theme properly. But not background attachment fixed. That CSS is overwritten with the code shown 2 posts above.

    Plugin Author Jeremy Herve

    @jeherve

    Since the .mobile-theme class is applied to the body tag itself, and not to a parent tag, .mobile-theme body isn’t targetting anything. You’d need to use body.mobile-theme instead.

    I noticed you’ve also added !important rules. These are not necessary here, but if you use such rules, the exclamation mark has to be placed before important, like so: !important

    I would also recommend adding ; at the end of each one of your properties. Thus you’ll avoid problems when adding a new property and forgetting to add that semicolon.

    In your case, adding this to your custom CSS should do the trick:

    body.mobile-theme {
        background-attachment: fixed;
        background-position: top center;
    }

    I hope this helps.

    Thank you Jeremy – this fixed the problem!

    I’m still not sure why this property wasn’t inherited/detected from the full-site theme settings, but it’s working now with the custom CSS, so problem solved.

    Thanks for the tip on the !important rules. I added them out of desperation just to see if they would help. Obviously, I didn’t quite add them properly, and they wouldn’t have helped anyway.

    Again, thanks for your help in resolving this problem!

    -Carlton

    This worked perfectly for me as well! Thank you both!

    i’m sorry. I’m a little slow here guys. I pasted that piece of code into the jetpack custom css but its had no effect on mobile. It works great on desktop and the background stays fixed, but mobile it just runs out as i scroll down.

    Plugin Author Jeremy Herve

    @jeherve

    @dyakir Could you please start your own thread, as per the Forum Welcome?
    http://wordpress.org/support/plugin/jetpack#postform

    If you let us know your site URL there, we’ll be able to take a closer look and see what’s wrong with the CSS you added to your site.

    Thank you!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Resolved] Background Image – Fixed Position (non-scrolling) is being ignored’ is closed to new replies.