- Responsive resizing help
-
Responsive resizing help
Okay, I kind of figured out what i need to do. I need to make the height of the parallax, which is located in css file, relative to the height of the image located in the html file. However, I don't know how i would call the image data from the html file into the css file in order to calculate the parallax height. Can anyone help me do this. Parallax css .parallax{ width:100%; height:700px; padding:0; margin:0; background-attachment:fixed; background-repeat:no-repeat; border-top:10px solid rgba(0,0,0,0.2); border-bottom:10px solid rgba(0,0,0,0.2); color:#000; position:relative; } .parallax .quoteWrap{ display:table; width:100%; height:100%; padding:0 !important; margin:0 !important; } .parallax.fixed{ background-attachment:fixed; } .parallax.fixed-desktop{ background-attachment:fixed !important; } .parallax .quoteWrap .quote{ display: table-cell; vertical-align:middle; } .parallax { text-align:center; } .parallax h3 span{ text-shadow: 0px 0px 5px #222; }
-
Responsive resizing help
Hi, a couple weeks back i asked a question on how to re-size an image in a type of "parallax container http://www.webdesignerforum.co.uk/topic/72755-website-resizing-help/. Unbeknownst to me i was causing another issue for myself, which aesthetically ruining the site in a mobile setting. Now my question is, how do i re-size an image for the desktop and then change it back to the the original mobile size constraints when opened in a mobile setting. Here is the my newly adjusted parallax code... <!--start parallax 1--> <div id="parallax-1" class="parallax fixed" style="background-image: url(images/parallax-1.jpg); background-size: 100%;"> <div class="quoteWrap"> <div class="quote"> <div class="container"> <div class="sixteen columns"> <h3><span class="largeBold">Intelligence</span> <span class="large">without ambition</span> <br><span class="medium">is a bird</span> <span class="mediumBold">without wings.</span> <br><span class="author">Salvador Dali</span> </h3> </div> </div> </div> </div> </div> <!--end parallax 1-->
- website resizing help
- website resizing help
-
website resizing help
Hi, thank you for your reply, and sorry for taking so long to respond. The site itself is made to adjust to the different medias quite well and does utilize the media queries. My issue is with the images inside the parallax which does not adjust in size no matter what the media. If the pictures are really big, some of the image will be cut out, and more of the image will be shown the larger the screen. If the image is really small, it will just be centered within the space allotted to the image through the code. I would like the amount of the image shown to remain constant no matter the size of the browser screen. Also to clarify I am somewhat a beginner at coding, so if you an point me to the right the direction like you already done for me, and also help me in finding where in the code to add the necessary alterations.
-
website resizing help
Hi, i'm working off a site template to create a website for myself, and i notice that backround images embedded in what the template refers to as a parallax werent resizing. The "parallax" in the index file calls to the parallax javascript file, and a style sheet in a seperate css file. In short how can i get the images to resize accoriding to the screen size or browser width. main.html <!--start parallax 1--> <div id="parallax-1" class="parallax fixed" style="background-image: url(images/parallax-1.jpg);"> <div class="quoteWrap"> <div class="quote"> <div class="container"> <div class="sixteen columns"> <h3><span class="largeBold">Intelligence</span> <span class="large">without ambition</span> <br><span class="medium">is a bird</span> <span class="mediumBold">without wings.</span> <br><span class="author">Salvador Dali</span> </h3> </div> </div> </div> </div> </div> <!--end parallax 1--> css file /*parallax --------------------------------------------------------*/ .parallax{ width:100%; height:700px; padding:0; margin:0; background-attachment:fixed; background-repeat:no-repeat; border-top:10px solid rgba(0,0,0,0.2); border-bottom:10px solid rgba(0,0,0,0.2); color:#000; position:relative; } .parallax .quoteWrap{ display:table; width:100%; height:100%; padding:0 !important; margin:0 !important; } .parallax.fixed{ background-attachment:fixed; } .parallax.fixed-desktop{ background-attachment:fixed !important; } .parallax .quoteWrap .quote{ display: table-cell; vertical-align:middle; } .parallax { text-align:center; } .parallax h3 span{ text-shadow: 0px 0px 5px #222; } javascpit file (function( $ ){ var $window = $(window); var windowHeight = $window.height(); $window.resize(function () { windowHeight = $window.height(); }); $.fn.parallax = function(xpos, speedFactor, outerHeight) { var $this = $(this); var getHeight; var firstTop; var paddingTop = 0; //get the starting position of each element to have parallax applied to it function update (){ $this.each(function(){ firstTop = $this.offset().top; }); if (outerHeight) { getHeight = function(jqo) { return jqo.outerHeight(true); }; } else { getHeight = function(jqo) { return jqo.height(); }; } // setup defaults if arguments aren't specified if (arguments.length < 1 || xpos === null) xpos = "50%"; if (arguments.length < 2 || speedFactor === null) speedFactor = 0.5; if (arguments.length < 3 || outerHeight === null) outerHeight = true; // function to be called whenever the window is scrolled or resized var pos = $window.scrollTop(); $this.each(function(){ var $element = $(this); var top = $element.offset().top; var height = getHeight($element); // Check if totally above or totally below viewport if (top + height < pos || top > pos + windowHeight) { return; } $this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px"); }); } $window.bind('scroll', update).resize(update); update(); }; })(jQuery);