responsive iframes now working! All basic layout working

master
David Kebler 2017-03-12 11:05:18 -07:00
parent 4073483d02
commit 79564fa926
11 changed files with 93 additions and 51 deletions

View File

@ -26,6 +26,8 @@ body{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding-top: 1em;
padding-bottom: 1em;
} }
/* mobile first column */ /* mobile first column */

View File

@ -87,6 +87,11 @@ padding-left:1em
justify-content: center; justify-content: center;
} }
.box--column {
flex-direction: column;
align-items: center;
}
.box--headline {} .box--headline {}
.box--text {} .box--text {}
@ -96,8 +101,12 @@ padding-left:1em
} }
.box__embed { .box__embed {
/*height: 100vh;*/
width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex-wrap: nowrap;
justify-content: center;
align-items: center; align-items: center;
} }

View File

@ -7,7 +7,7 @@ $(document).ready(function () {
thumbWidth: 80, thumbWidth: 80,
controls: true, controls: true,
loop: false, loop: false,
download: true, download: false,
counter: true, counter: true,
// videojs: true // videojs: true
}); });
@ -20,14 +20,9 @@ $(document).ready(function () {
$('.nav-bar').css("display", "flex") $('.nav-bar').css("display", "flex")
}); });
lg.on('onBeforeOpen.lg', function (event) {
$('.nav-bar').css("display", "none")
});
// initialize hero size // initialize hero size
heroResize(); heroResize();
// iframeResize(); iframeResize();
// jQuery('iframe').fitToParent(); // for all iframes
$('section').flowtype({ $('section').flowtype({
// maximum: 1000, // maximum: 1000,
@ -42,10 +37,9 @@ $(document).ready(function () {
}); });
// resize elements on change // resize elements on change
$(window).resize(function () { $(window).smartresize(function () {
heroResize(); heroResize();
// iframeResize(); iframeResize();
// jQuery('iframe').fitToParent();
}); });
}); });

View File

@ -1,3 +1,13 @@
//
// // get all original iframe dimensions
// (function iframeInit() {
// $('iframe').each(function (i) {
// console.log(i, $(this).attr('height'), $(this).attr('width'));
// this.aspect = $(this).attr('height') / $(this).attr('width')
// console.log('aspect iframe', i, this.aspect)
// })
// }());
// videos - preload // videos - preload
(function videoInit() { (function videoInit() {

View File

@ -1,8 +1,8 @@
// hero resizer // hero resizer
function heroResize() { function heroResize() {
jQuery('#hero').css({ $('#hero').css({
width: jQuery(window).width(), width: $(window).width(),
height: jQuery(window).height() height: $(window).height()
}); });
} }
@ -22,7 +22,7 @@ $('a[href*="#"]:not([href="#"])').click(function () {
} }
}); });
// navbar - preload // navbar mobile toggle - preload
(function navbarInit() { (function navbarInit() {
function toggleMobileMenu() { function toggleMobileMenu() {
@ -33,24 +33,47 @@ $('a[href*="#"]:not([href="#"])').click(function () {
}()); }());
// function iframeResize(percent = 1) { function iframeResize(maxWidth = 450) {
// console.log('window width', percent, $(window).width()) var windowWidth = $(window).width()
// console.log('section_content', percent, $('.section__content').width()) var width = (windowWidth > maxWidth) ? maxWidth : windowWidth - 20
// console.log('box embed width', percent, $('.box__embed').width()) // alert(`before ww width ${windowWidth} ${width}`)
// $('iframe').each(function (i) { jQuery('iframe').fitToParent({
// console.log('aspect', this.aspect) heightOffset: 0, // (int) Put some space around the element
// $(this).attr('height', this.aspect * $('.box__embed').width()) // widthOffset: 5, // (int) Put some space around the element
// $(this).attr('width', $('.box__embed').width()) // boxHeight: , // (int) Will look for .size-parent, or fallback to parent size
// }) boxWidth: width, // (int) Will look for .size-parent, or fallback to parent size
// console.log('new width and height', $('iframe')[0].width, $('iframe')[0].height) callback: function (newWidth, newHeight) {
// console.log('new width and height', $('iframe')[1].width, $('iframe')[1].height) // alert(`after w h ${newWidth} ${newHeight}`)
// } // Fires after fitting is complete
// }
// // get all original iframe dimensions })
// (function iframeInit() { }
// $('iframe').each(function (i) {
// console.log(i, $(this).attr('height'), $(this).attr('width')); // debouncing function for window resize from John Hann
// this.aspect = $(this).attr('height') / $(this).attr('width') // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
// console.log('aspect iframe', i, this.aspect) (function ($, sr) {
// }) var debounce = function (func, threshold, execAsap) {
// }()); var timeout;
return function debounced() {
var obj = this,
args = arguments;
function delayed() {
if (!execAsap)
func.apply(obj, args);
timeout = null;
};
if (timeout)
clearTimeout(timeout);
else if (execAsap)
func.apply(obj, args);
timeout = setTimeout(delayed, threshold || 100);
};
}
// smartresize
jQuery.fn[sr] = function (fn) { return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
})(jQuery, 'smartresize');

View File

@ -10,5 +10,5 @@ anchor="atext ut"
Built in 1977 in Central Point, Oregon this 1548 sq. ft. Rambler/Ranch Style House has 3 bedrooms, 2 baths, covered patio, and an attached 2-car garage. It would be perfect for two child family or a couple wanting a spare bedroom and an office. Since 2007 the house has had numerous updates and is move-in ready. It is located within easy walking distance to Central Point's high and middle schools as well as the Bear Creek Greenway, Jackson County Expo and a RVTD bus stop. Built in 1977 in Central Point, Oregon this 1548 sq. ft. Rambler/Ranch Style House has 3 bedrooms, 2 baths, covered patio, and an attached 2-car garage. It would be perfect for two child family or a couple wanting a spare bedroom and an office. Since 2007 the house has had numerous updates and is move-in ready. It is located within easy walking distance to Central Point's high and middle schools as well as the Bear Creek Greenway, Jackson County Expo and a RVTD bus stop.
{{< embed type="google-map" title="A Title" caption="A caption" >}} {{< embed type="google-map" title="A Title" caption="A caption" >}}
<!-- <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2946.84955578167!2d-122.92451728429863!3d42.38835127918494!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x54cf7c44f081d5df%3A0x72a99d35e8998a87!2s4005+Rock+Way%2C+Central+Point%2C+OR+97502!5e0!3m2!1sen!2sus!4v1488952358943" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe> --> <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2946.84955578167!2d-122.92451728429863!3d42.38835127918494!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x54cf7c44f081d5df%3A0x72a99d35e8998a87!2s4005+Rock+Way%2C+Central+Point%2C+OR+97502!5e0!3m2!1sen!2sus!4v1488952358943" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
{{< /embed >}} {{< /embed >}}

View File

@ -4,4 +4,4 @@ title = "Photo Gallery"
link_text = "Photos" link_text = "Photos"
weight = 2 weight = 2
+++ +++
{{% gallery %}} {{% 4005-gallery %}}

View File

@ -4,6 +4,6 @@ title = "Video Walk Through"
weight = 3 weight = 3
link_text = "Video" link_text = "Video"
+++ +++
{{< embed youtube-video >}} {{< embed youtube >}}
<!-- <iframe width="560" height="315" src="https://www.youtube.com/embed/Fv2BF_V8cWM" frameborder="0" allowfullscreen></iframe> --> <iframe width="560" height="315" src="https://www.youtube.com/embed/Fv2BF_V8cWM" frameborder="0" allowfullscreen></iframe>
{{< /embed }} {{< /embed }}

View File

@ -16,6 +16,9 @@
<script src="js/analytics.js"></script> <script src="js/analytics.js"></script>
{{ end }} {{ end }}
<!-- sizing tools -->
<script src="js/fitToParent.js"></script>
<!-- development tools --> <!-- development tools -->
<script src="js/lorem.js"></script> <script src="js/lorem.js"></script>

View File

@ -3,12 +3,13 @@
<div class="box box--{{ .Get "type" }}"> <div class="box box--{{ .Get "type" }}">
{{ with .Get "title" }} {{ with .Get "title" }}
<div class="box__title">{{ . }}</div> <div class="box__title">{{ . }}</div>
{{ end }} {{ with .Get "caption"}}
<div class="box__caption">{{ . }}</div>
{{ end }} {{ end }}
<div class="box__embed box__embed--{{ .Get "type" }}"> <div class="box__embed box__embed--{{ .Get "type" }}">
{{ .Inner }} {{ .Inner }}
</div> </div>
{{ with .Get "caption"}}
<div class="box__caption">{{ . }}</div>
{{ end }}
</div> </div>
{{ else }} {{ else }}
<div class="box box--{{ .Get 0 }}"> <div class="box box--{{ .Get 0 }}">