Forum Replies Created
-
AuthorPosts
-
January 17, 2024 at 3:09 am in reply to: Can’t scroll in burger menu on phone to get at lower/hidden menu items #1430767
Hi Mike!
Thanks for that suggestion. I was thus able to find the stylesheets responsible:
(1) For the purpose of my bullets, I did a:
ul { padding-bottom: 0; }
but that also affected my menus, since Enfold/Aria implements the menus using unordered lists. So I removed that line. This was the main culprit preventing scrolling in the burger menu (for some reason).
(2) In addition, many months ago in my development I made my burger menus responsive to HEIGHT of the window too (i.e. in addition to all my general responsiveness to width everywhere). Somewhere along the way that code stopped working without my realizing it (because it originally worked), and so I just redid the breakpoints and CSS code. For example:
@media only screen and (max-width: 614px) and (min-height: 900px) and (max-height: 999px) { #top .av-burger-overlay { margin-top: 160px !important; height: 730px !important; } }
Thanks for all your help. I can’t tell you how relieved I am that this problem is fixed. That was the last thing stopping me from publishing (I hope). You can close this topic if you wish.
All the best,
GaryJanuary 16, 2024 at 3:07 pm in reply to: Can’t scroll in burger menu on phone to get at lower/hidden menu items #1430709Actually, come to think of it, the fact that my burger menu doesn’t scroll makes the bottom menu item in the window the de facto bottom of my menu, so that preventDefault error triggering as soon as I try to scroll makes sense (vis-à-vis your demo menu), so it’s probably an irrelevant error.
January 16, 2024 at 4:46 am in reply to: Can’t scroll in burger menu on phone to get at lower/hidden menu items #1430193Hi Mike!
Thank you for your feedback.
So I fixed the two errors you mentioned and I’m not seeing any other errors…
…except when I have a mobile-sized window in the DevTools, open my burger menu, and use my mouse to scroll. This causes multiple errors all saying:
Unable to preventDefault inside passive event listener invocation. jquery.min.js?ver=3.7.1:2
I tracked down where Enfold/Avia enqueues this file–in: config-layerslider/LayerSlider/assets/wp/scripts.php. Searching the web for this error message gives possible solutions, like removing the call to preventDefault(). But I sure as heck don’t want to mess with the Ajax libraries.
I’m not sure if this is related to my inablity to scroll in my burger menus or not. Since I’m able to scroll through your demo’s burger menu, I assume there is something else in my code that is preventing me from scrolling.
However, note that this same preventDefault error does appear even in your demo’s burger menu if I scroll past the bottom of it, and multiple instances of the error are displayed as I continue to try to scroll past the bottom of your burger menu. But the preventDefault error appears for my website even if I’m not at the bottom–since I can’t even see the bottom.
Any help would be appreciated.
Thanks,
GaryNovember 14, 2023 at 9:29 pm in reply to: Burger Close “X” icon showing X & Y scrollbars (in the icon image itself) #1425599Hi Ismael!
Thanks so much for the suggestion! That did the trick, i.e. replacing “auto” with “hidden” in that line. It hid both x & y scrollbars in Firefox & Safari, and the y scrollbar in Chrome. I don’t know why they started appearing now whereas months ago the “auto” there worked fine; but who am I to complain at this point, since I want to publish this website once and for all. All good.
By the way, I don’t know why the scrollbar(s) only appeared for you on hover, and very thin, when for me in all browsers on the Mac & PC they appeared without hovering. Oh well, all’s well. You can close the thread.
Thanks again,
GaryNovember 9, 2023 at 10:43 pm in reply to: Burger Close “X” icon showing X & Y scrollbars (in the icon image itself) #1425174Hi Ismael!
Thanks so much for replying!
That is so weird. My above pic was for both Firefox & Safari on my brother’s home Mac, and the screenshots in my private area show just the vertical scrollbar in Chrome on both the Mac and in Windows 7 on a PC in the office (remotedly accessed via the Mac). Firefox on the PC also showed both scrollbars as it did on the Mac. I can’t explain it. Thoughts?
Gary
November 9, 2023 at 12:32 am in reply to: Burger Close “X” icon showing X & Y scrollbars (in the icon image itself) #1425042Oh, and I also turned off all my plugins, but it didn’t help.
June 25, 2023 at 2:22 am in reply to: Image opening in Lightbox singly without arrows to scroll through all images #1411588Thanks, Mike, for checking. Sure, we can keep this thread open for future users. Always happy to help others, a little bit like you do every day!
Thanks and all the best,
Gary.June 22, 2023 at 4:55 am in reply to: Image opening in Lightbox singly without arrows to scroll through all images #1411336Thanks very much for your suggestion, Mike. It helped me look quite deeply into this issue using Chrome’s debugger. I want to first apologise to you for keeping things so complicated using my in-development home page, which is quite complicated, instead of creating a test page for this topic question–which is exactly what I did to debug this issue after your reply.
It turns out that the stackoverflow suggestion doesn’t work. Their suggestion is to add itemOpts.index = index; before the mfp._openClick({mfpEl:items}, jqEl, itemOpts); line as follows:
$.fn.magnificPopup = function(options) { _checkInstance(); var jqEl = $(this); // We call some API method of first param is a string if (typeof options === "string" ) { if(options === 'open') { var items, itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup, index = parseInt(arguments[1], 10) || 0; if(itemOpts.items) { items = itemOpts.items[index]; } else { items = jqEl; if(itemOpts.delegate) { items = items.find(itemOpts.delegate); } items = items.eq( index ); } itemOpts.index = index; // Added line per https://stackoverflow.com/questions/49131727/open-all-images-on-page-with-magnific-popup mfp._openClick({mfpEl:items}, jqEl, itemOpts); } else { if(mfp.isOpen) mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1)); } } else { // clone options obj options = $.extend(true, {}, options); /* * As Zepto doesn't support .data() method for objects * and it works only in normal browsers * we assign "options" object directly to the DOM element. FTW! */ if(_isJQ) { jqEl.data('magnificPopup', options); } else { jqEl[0].magnificPopup = options; } mfp.addGroup(jqEl, options); } return jqEl; };
The problem is that that bug fix never even gets to run because it’s encapsulated within the IF condition of typeof options === “string”, as you can see above. So if you look at BOTH:
(1) us Enfold users:
links.not(options.exclude).addClass('lightbox-added') .magnificPopup($.avia_utilities.av_popup);
where $.avia_utilities.av_popup === {type: ‘image’, mainClass: ‘avia-popup mfp-zoom-in’, tLoading: ”, tClose: ”, removalDelay: 300, …}
(2) and the Original Poster to that stackoverflow thread:
$('#content').magnificPopup({ items: $imgs, type: 'image', gallery: { enabled: true }, });
you can see that typeof options === “object”! So it wouldn’t work for either of us (the OP coincidentally was wanting to do the exact same thing as me, to “enable magnific popup on all images on my page”). Unfortunately, the OP never responded to the reply person’s bug fix suggestion, so the thread never went further in order to highlight the failure of the suggestion for the OP.
After ruling out magnific’s code as the culprit of my problem, I focused on avia-snippet-lightbox.js and its code at the end of its function, $.fn.avia_activate_lightbox = function(variables):
return this.each(function() { var container = $(this), videos = $(options.videoElements, this).not(options.exclude).addClass('mfp-iframe'), /*necessary class for the correct lightbox markup*/ ajaxed = ! container.is('body') && ! container.is('.ajax_slide'); for( var i = 0; i < options.groups.length; i++ ) { container.find(options.groups[i]).each(function() { var links = $(options.autolinkElements, this); if( ajaxed ) { links.removeClass('lightbox-added'); } links.not(options.exclude).addClass('lightbox-added').magnificPopup($.avia_utilities.av_popup); }); } });
Sure enough, this is the culprit. What’s happening in this code above is that:
(1) the outer loop, controlled by the FOR loop, searches the <body> DOM for each class in the options object (.avia-slideshow, .avia-gallery, .av-horizontal-gallery, .av-instagram-pics, .portfolio-preview-page, .portfolio-preview-content, .isotope, .post-entry, .sidebar, #main, .main-menu, & .woocommerce-product-gallery); and if it finds the current options[i] in the <body> DOM, then:
(2) the inner loop, controlled by “.each(function()”, looks for every instance of that options[i] in body and adds the images within that sub-DOM instance to the links object “array”. In other words, it creates multiple lightboxes per page–and, in fact, NOT JUST a separate one for each options[i] image set (from the outer loop), BUT ALSO a separate lightbox for each instance of options[i] as well.
But I want a single lightbox for all linked images on a page, i.e. a single image set that is sent to magnific. Specifically, for me, options[7]===’.post-entry’ is not only found in outer 1/1, 1/2, etc. layout sections, in which I may put images, but also in Color Sections, in which I will definitely put images, perhaps in inner 1/1, 1/2, etc. layout sections within the Color Sections. It’s the Color Section that ends up separating out ‘.post-entry’ images from each other, creating multiple image sets sent to magnific for separate lightboxes (notice the <div class=’post-entry post-entry-type-page post-entry-31′> line):
<div class='avia-section av-lib3uyi7-57ce06e0452ac92eb7d4393a8384e180 main_color avia-section-default avia-no-border-styling avia-builder-el-62 el_after_av_section el_before_av_section mainPageBodyThreeCols avia-bg-style-scroll container_wrap fullsize' > <div class='container av-section-cont-open' > <div class='template-page content av-content-full alpha units'> <div class='post-entry post-entry-type-page post-entry-31'> <div class='entry-content-wrapper clearfix'> <div class='flex_column av-i3z0f-243165cc077a80e50bbee8f020d21535 av_one_third avia-builder-el-63 el_before_av_one_third avia-builder-el-first first flex_column_div ' > <div class='avia-image-container av-lib47uf4-9660e94fab46a96b36ab619c8b679a09 av-styling- avia-align-center avia-builder-el-64 el_before_av_textblock avia-builder-el-first av-group-lightbox' itemprop="image" itemscope="itemscope" itemtype="https://schema.org/ImageObject" > <div class="avia-image-container-inner"> <div class="avia-image-overlay-wrap"> <a href="...dentures.jpg" class='avia_image' > <img decoding="async" class='wp-image-699 avia-img-lazy-loading-not-699 avia_image ' src="...dentures-300x264.jpg" alt='...' height="264" width="300" itemprop="thumbnailUrl" srcset="..." sizes="(max-width: 300px) 100vw, 300px" /> </a> </div> </div> </div>...
In other words, each .avia-section (Color Section) has its own class=’post-entry post-entry-type-page post-entry-31′, so the images under that DOM are collected as a separate image set for a lightbox.
So I ended up just bypassing all of it, and replaced the code in avia-snippet-lightbox.js with my own child_avia-snippet-lightbox.js:
return this.each(function() { //Find all linked images var myLinks = $(options.autolinkElements, this); //Note: ".not(options.exclude)" is left out of this "myLinks.not(options.exclude).addClass(..." on purpose to impose the policy: if you want to exclude an image from the all-images set in the lightbox, just don't make it a link. Linked images excluded from the lightbox means if the user clicks on that linked image, it will follow that link, which is to open it's full size image, but without the lightbox's closing mechanism. Then the only way for the user to go back to the page is to click the Back button--which is bad UX. myLinks.addClass('lightbox-added').magnificPopup($.avia_utilities.av_popup); });
And adding this to my child functions.php file:
add_action('wp_enqueue_scripts', 'magnific_script_fix', 100); function magnific_script_fix() { wp_dequeue_script('avia-lightbox-activation'); wp_enqueue_script('child_avia-lightbox-activation', get_stylesheet_directory_uri().'/child_avia-snippet-lightbox.js', array('jquery')); }
Also, as you can see, I’ve left out “.not(options.exclude)” from myLinks.not(options.exclude).addClass(‘lightbox-added’).magnificPopup($.avia_utilities.av_popup) for the following reason: If I put it in, then, yes, the images with those exclusion classes will be excluded from the lightbox. But they are still linked images: so if a user clicks on one of them, it will follow that link, which is to open it’s full size image, but without the lightbox’s closing mechanism. So the only way for the user to go back to the page is to click the Back button–which is bad UX.
FYI: I attempted to figure out a way to add each of those excluded images in its own individual one-image lightbox, but I just couldn’t even figure out how Enfold does the not(options.exclude), as a starting point (going step by step in the debugger to see how it’s doing it was a bewildering experience), so I just gave up. So I just gave myself the policy: if you want to exclude an image from the all-images set in the lightbox, just don’t make it a link. Lol. Yes, I could have left the .not(options.exclude) in there and just not used it per my policy, but I wanted to make sure the UX stays correct by preventing me (or anyone else maintaining the site) from having any effect to forgetting the policy and adding e.g. “noLightbox” to an image’s Custom CSS Class field, expecting it to be excluded from the lightbox, but still keeping the image’s link active. No: if I (or they) go into the code, they’ll see there is no .not(options.exclude) at all, and read the comment in the code, to see why their image is not getting excluded from the lightbox.
So, anyway, that’s my solution to my particular problem. I appreciate your help, Mike. Unless you have some solution code for me to include those excluded images in their own individual one-image lightboxes (which would be helpful to just round up this solution, in case others want to use it), you may close this thread.
Thanks very much,
Gary- This reply was modified 1 year, 4 months ago by garysch37.
Thank you, Ismael, for your reply. I appreciate your team trying to figure out this anomaly. Good luck!
All the best,
GaryJune 2, 2023 at 12:24 am in reply to: Image opening in Lightbox singly without arrows to scroll through all images #1409327Thank you for replying Ismael. I appreciate you helping me. Unfortunately, “av-group-lightbox” didn’t work for me.
First, I didn’t realize I needed to add a class to every image I want to open up in the lightbox gallery on a particular page. As I mentioned in my original post, point #2, all images on the page in my original test, except the office photo inside its Color Section, opened in the lightbox gallery, WITHOUT MY HAVING TO ADD ANY CLASS TO CONNECT THEM TOGETHER. I just didn’t understand why a Color Section was messing things up. I assumed that to omit an image from the lightbox gallery, you just don’t create a link on it, and if the image is linked, then it’s part of the lightbox gallery.
It’s actually weird that all those images did open in the lightbox gallery connected together without a class, because I have found some people on the Internet talk about how Magnific Popup requires you to add a class to all images on a page that you want to include in the gallery, just like you said.
Or the class is to be added to the links of the images perhaps, like the leadership at https://help.groupthought.com/article/64-pages-how-to-show-an-image-in-a-pop-up-window are telling their people to do:
$(document).ready(function() { $('.template-article img').each(function() { var currentImage = $(this); currentImage.wrap("<a class='image-link' href='" + currentImage.attr("src") + "'</a>"); }); $('.image-link').magnificPopup({type:'image'}); });
But I don’t know how to easily give a class to my image links, so I just went ahead with your suggestion. When I did a hard refresh of my page, I saw that the “av-group-lightbox” class was added to the avia-image-container <div>:
<div class='avia-image-container av-liaq7z66-359c3e896ff6ab62eb93041dca6e9e63 av-styling- avia-align-center avia-builder-el-5 avia-builder-el-no-sibling av-group-lightbox' itemprop="image" itemscope="itemscope" itemtype="https://schema.org/ImageObject" > <div class="avia-image-container-inner"> <div class="avia-image-overlay-wrap"> <a href="...dog_chewing_denture.jpg" class='avia_image' > <img decoding="async" class='wp-image-191 avia-img-lazy-loading-not-191 avia_image ' src="...dog_chewing_denture-284x300.jpg" alt='' title='dog_chewing_denture' height="300" width="284" itemprop="thumbnailUrl" srcset="..." sizes="(max-width: 284px) 100vw, 284px" /> </a> </div> </div> </div>
Anyway, let me run down my analysis:
******
TEST 1
******First, this is my home page at the moment (which has developed since I first wrote), where all Image Media Element images have Advanced > Link Settings set to Open in Lightbox, EXCEPT AS INDICATED OTHERWISE:
- Dog (test image) in a 1/1 column layout element
- Office Photo in Color Section
- Color Section with text
- Middle-aged couple (test image) in a 1/1 column layout element
- Empty Color Section
- Woman holding dentures (test image)
- Couple on beach (test image) inside a Textblock in a 1/1 column layout element: this embedded image has Display Settings > Link To = Media File (with URL set to the image’s Media Library original full size URL)
- Couple with pretzel & coffee (test image) inside a Textblock in a 1/1 column layout element
- Color Section containing a heading, “Our Services”, in a 1/1 column layout element.
- Color Section for Our Services with 3 rows 3 columns:
- The oral surgery test image again (full size this time), inside a 1/1 column layout element (test image)
– A bunch of dentures photo (small thumbnail-like image) inside the first 1/3 column layout element
– An oral surgery photo (small thumbnail-like image) inside the second 1/3 column layout element (first row)
– A denture on implants (small thumbnail-like image) inside the third 1/3 column layout element (first row): Advanced > Link Settings set to Set Manually and linked to the original full size image using its Media Library URL
– …the rest of the images in the grid-like Color Section have their images set to nothing (all 1/3 columns in this “Our Services” Color Section are designed to link to the pages discussing those specific services, except I removed that column link in the first row of images for test purposes)RESULTS WITHOUT “av-group-lightbox”, with Open in Lightbox (and the one manual setting):
- The following images opened up as singular: Dog, Office, Middle-aged couple
- The following images opened connected together in the lightbox gallery: Woman holding dentures, Beach couple, Pretzel couple
- All 3 images from my grid-like Color Section that I defined to Open in Lightbox did so (they were connected together).
So to me it seems like Color Section breaks up image groupings as follows:
- Since there is a Color Section after the dog, it isolates the dog, making it open singly in the lightbox.
- There is only 1 image, the office, inside the Color section following the dog, so it opens singly in the lightbox.
- Since there is an empty Color Section after the Middle-aged couple, it’s isolated and opens singly in the lightbox.
- The next Color Section, containing the “Our Services” heading, comes after the Pretzel couple, so we have 3 images between two Color Sections, allowing them to be connected together to open as a gallery in lightbox.
- The Color Section after that contains our grid-like images (and their headings & blurbs), making all images inside that Color Section set to Open in Lightbox open together in the lightbox as a gallery.
- And the final image at the bottom, our full size oral surgery, is isolated after the previous Color Section, making it open singly in the lightbox.
******
TEST 2
******Then I thought, for the heck of it, I’ll replace all “Advanced > Link Settings = Open in Lightbox” with “Advanced > Link Settings = Set Manually” & URL pointing to the original full size image’s URL in the Media Library.
RESULTS WITHOUT “av-group-lightbox” and manual URL instead of Open in Lightbox: No change–I got the same results. It’s as if it’s the anchor link on the image (which I assume Open in Lightbox also sets) that determines what goes together–within the Color Section mess-up criterion I found.
******
TEST 3
******So I’m left with my problem of being able to open all images on the page I wish to together in a single lightbox gallery, irrespective of what Color Sections may exist on the page–which brings us to your kindly proposed solution.
So, for testing, I added “av-group-lightbox” to the Advanced > Developer Settings > Custom CSS Class field of the following images on my home page as specified below:
- *Dog: av-group-lightbox
- *Office Photo: av-group-lightbox
- Color Section with text
- *Middle-aged couple: av-group-lightbox
- Empty Color Section
- Woman holding dentures
- *Beach couple: av-group-lightbox
- *Pretzel couple: av-group-lightbox
- Color Section with 3 rows 3 columns, with “av-group-lightbox” just in the first 2 images:
- *Full size Oral surgery: av-group-lightbox
– *A bunch of dentures: av-group-lightbox
– *Oral surgery: av-group-lightbox
– Implants denture
– …the rest of the images in the grid-like Color SectionRESULTS WITH “av-group-lightbox” (with either Open in Lightbox or Set Manually–it didn’t matter): There was no change compared to the WITHOUT case:
- The following images opened up as singular: Dog, Office, Middle-aged couple
- The following images opened connected together in the lightbox gallery: Woman holding dentures, Beach couple, Pretzel couple
- All 3 images from my grid-like Color Section that I defined to Open in Lightbox did so connected together, including the Implant denture that I didn’t have “av-group-lightbox” on.
******
TEST 4
******I also tested with “avia-image” instead of “av-group-lightbox”, since I read somewhere in Enfold documentation/support that for an image embedded in a text block (like my Beach couple), you set Link CSS Class = “avia-image” (without quotes).
By the way, I searched through all Enfold parent files (using the Double Commander tool on my computer after downloading the entire Enfold folder to my computer on Jul 30, 2022), and found no “av-group-lightbox” string inside any files anywhere. Did things change perhaps since my download date? I also looked through the downloaded HTML (Developer’s Page Source), and there is basically no difference between the DOMs and classes for all images (except for the obvious stuff).
Any ideas?
Thanks,
Gary- This reply was modified 1 year, 5 months ago by garysch37.
- This reply was modified 1 year, 5 months ago by garysch37.
- This reply was modified 1 year, 5 months ago by garysch37.
- This reply was modified 1 year, 5 months ago by garysch37. Reason: All these edits were to get my reply to render properly (sorry)
- This reply was modified 1 year, 5 months ago by garysch37.
- This reply was modified 1 year, 5 months ago by garysch37.
- This reply was modified 1 year, 5 months ago by garysch37.
- This reply was modified 1 year, 5 months ago by garysch37.
Hi Mike!
Thank you for your solution: that was what I needed.
I did have to tweak it a bit: it turned out that the “line-height:30px” was fine, but I couldn’t do the “height:30px” because then the submenu looses the wrapped text part of any extra long submenu items (it would just display the first line, but not the second line, of the wrap), and the hover bar on a submenu item looses it’s bottom padding. I don’t understand how, but the “line-height:30px”, plus moving the top of the “.main_menu” (and moving the margin-top of the “.sub-menu”), was sufficient to loose that “padding” above the menu.
The only weird thing was that I lose your solution at browser widths 615-767px. If I try to reapply it within those breakpoints:
#header.av_minimal_header .main_menu ul:first-child > li a { line-height: 30px !important; }
I end up creating a problem at the burger activation point of (max-width: 614px), where now the burger icon is squished to 30px high instead of its 80px high. But if I do this at this burger activation point:
#header.av_minimal_header .main_menu ul:first-child > li a { line-height: 80px !important; }
then the submenu items in the overlay are all spaced 80px vertically. I don’t know how to get around this. So I decided that since we’re only talking about the padding-above-the-menu problem at widths 615-767px, I can put up with this spacing problem. So I’ll just do nothing at 767px to fix it. I’m content with this.
Thanks,
Gary- This reply was modified 1 year, 5 months ago by garysch37.
May 21, 2023 at 8:17 am in reply to: Set image source filename in Javascript to swap/switch for responsive images #1408049Thank you very much, Mike. That did the trick: I didn’t realize I could access the srcset field in img like that, doh! So now I know how to do that, for the situations I need it.
And the situation came up immediately, as I ended up changing my method of doing this home page banner, to use the second method I mentioned, putting my background graphic into the Color Section, and my happy couple image in an Image media element in that Color Section, and then making it all responsive, including using your querySelector with src & srcset to swap out the happy couple images responsively at certain breakpoints, and using it again with backgroundImage to swap out my background graphic at the same breakpoints. Yes, it may seem weird that I’m swapping images manually instead of using srcset, but it was all necessary at these breakpoints (or I’m just not experienced enough to have figured it out). It all worked out nicely.
I even answered my own question about that blue bar under the banner: I totally forgot that WordPress makes background images default to repeating, so I just had to turn repeat off.
Thanks again for all your help! You can close this thread if you wish. /gary
Here’s the final code in case others are interested:
In child theme’s function.php:
function displayHomeBanner() { if (window.matchMedia("(min-width: 1px) and (max-width: 579px)").matches) { // BG GRAPHIC: document.querySelector(".seniorCoupleContainer").style.backgroundImage="none"; // COUPLES PIC: document.querySelector(".seniorCouple img").src="...happy-senior-couple-5-556x313px.png"; document.querySelector(".seniorCouple img").srcset="...happy-senior-couple-5-556x313px.png"; } if (window.matchMedia("(min-width: 580px) and (max-width: 819px)").matches) { // BG GRAPHIC: document.querySelector(".seniorCoupleContainer").style.backgroundImage="url('...home-page-banner-background-4-1079x300px.png')"; document.querySelector(".seniorCoupleContainer").style.backgroundSize="1079px 300px"; document.querySelector(".seniorCoupleContainer").style.backgroundRepeat = "no-repeat"; // COUPLES PIC: document.querySelector(".seniorCouple img").src="...happy-senior-couple-4-510x287px.png"; document.querySelector(".seniorCouple img").srcset="...happy-senior-couple-4-510x287px.png"; } if (window.matchMedia("(min-width: 820px) and (max-width: 989px)").matches) { // BG GRAPHIC: document.querySelector(".seniorCoupleContainer").style.backgroundImage="url('...home-page-banner-background-3-1439x400px.png')"; document.querySelector(".seniorCoupleContainer").style.backgroundSize="1439px 400px"; document.querySelector(".seniorCoupleContainer").style.backgroundRepeat = "no-repeat"; // COUPLES PIC: document.querySelector(".seniorCouple img").src="...happy-senior-couple-3-700x394px.png"; document.querySelector(".seniorCouple img").srcset="...happy-senior-couple-3-700x394px.png"; } if (window.matchMedia("(min-width: 990px) and (max-width: 1199px)").matches) { // BG GRAPHIC: document.querySelector(".seniorCoupleContainer").style.backgroundImage="url('...home-page-banner-background-2-1778x500px.png')"; document.querySelector(".seniorCoupleContainer").style.backgroundSize="1778px 500px"; document.querySelector(".seniorCoupleContainer").style.backgroundRepeat = "no-repeat"; // COUPLES PIC: document.querySelector(".seniorCouple img").src="...happy-senior-couple-2-871x490px.png"; document.querySelector(".seniorCouple img").srcset="...happy-senior-couple-2-871x490px.png"; } if (window.matchMedia("(min-width: 2000px)").matches) { // BG GRAPHIC: document.querySelector(".seniorCoupleContainer").style.backgroundImage="url('...home-page-banner-background.png')"; document.querySelector(".seniorCoupleContainer").style.backgroundRepeat = "no-repeat"; document.querySelector(".seniorCoupleContainer").style.backgroundSize="2881px 601px"; // COUPLES PIC: document.querySelector(".seniorCouple img").src="...happy-senior-couple.png"; document.querySelector(".seniorCouple img").srcset="...happy-senior-couple.png"; } }
In child theme’s style.css:
.seniorCoupleContainer { background-image: url(https://www.clearlightcomputing.com/denture6/wp-content/uploads/2023/05/home-page-banner-background.png); background-repeat: no-repeat; background-size: 2881px 601px; max-height: 591px; /* Without this there is an inexplicable bottom padding (zeroing margin and padding does nothing): height of senior pic 576 + reset top 35 = 611, but this still leaves a 20px bottom padding. */ } .seniorCouple { top: -35px; } /* Get rid of the bottom padding at all these breakpoints because it accummulates between the breakpoints, so this code sort of does a reset of 0 padding: */ @media only screen and (min-width: 1px) and (max-width: 349px) { .seniorCoupleContainer { max-height: 171px; } } @media only screen and (min-width: 350px) and (max-width: 369px) { .seniorCoupleContainer { max-height: 185px; } } @media only screen and (min-width: 370px) and (max-width: 389px) { .seniorCoupleContainer { max-height: 199px; } } @media only screen and (min-width: 390px) and (max-width: 409px) { .seniorCoupleContainer { max-height: 213px; } } @media only screen and (min-width: 410px) and (max-width: 429px) { .seniorCoupleContainer { max-height: 227px; } } @media only screen and (min-width: 430px) and (max-width: 449px) { .seniorCoupleContainer { max-height: 241px; } } @media only screen and (min-width: 450px) and (max-width: 469px) { .seniorCoupleContainer { max-height: 255px; } } @media only screen and (min-width: 470px) and (max-width: 489px) { .seniorCoupleContainer { max-height: 267px; } } @media only screen and (min-width: 490px) and (max-width: 519px) { .seniorCoupleContainer { max-height: 284px; } } @media only screen and (min-width: 520px) and (max-width: 549px) { .seniorCoupleContainer { max-height: 299px; } } @media only screen and (min-width: 550px) and (max-width: 579px) { .seniorCoupleContainer { max-height: 313px; } } @media only screen and (min-width: 1px) and (max-width: 579px) { .seniorCouple { top: -50px; width: 564px; /* without this it's smaller for some reason */ } } @media only screen and (min-width: 580px) and (max-width: 819px) { .seniorCoupleContainer { max-height: 302px; /* Get rid of bottom padding. */ } .seniorCouple { width: 510px; /* without this it's smaller for some reason */ } } @media only screen and (min-width: 820px) and (max-width: 989px) { .seniorCoupleContainer { max-height: 409px; /* Get rid of bottom padding. */ } .seniorCouple { width: 700px; /* without this it's smaller for some reason */ } } @media only screen and (min-width: 990px) and (max-width: 1199px) { .seniorCoupleContainer { max-height: 505px; /* Get rid of bottom padding. */ } .seniorCouple { width: 871px; /* without this it's smaller for some reason */ } } @media only screen and (min-width:2000px) { .seniorCoupleContainer { width: 100% !important; height: 591px; max-height: 591px; /* Get rid of bottom padding. */ } .seniorCouple { width: 1024px; } }
May 20, 2023 at 5:44 am in reply to: Set image source filename in Javascript to swap/switch for responsive images #1408007Just one more thing, Mike. Can you please tell me why there is that blue stripe underneath my new experimental Color Section that also shrinks responsively as I decrease the browser window’s width, and then disappears around 1005px wide–before the responsive 964px width. It’s not part of the original background graphic, but it also doesn’t show if I don’t display the background image on the wider screens. Thanks, Gary
May 20, 2023 at 5:27 am in reply to: Set image source filename in Javascript to swap/switch for responsive images #1408002Hi Mike!
That is so bizarre, because here’s the HTML in Chrome’s inspector for the image’s element (which is also seen in your screen shot in my private area):
<img decoding="async" class="wp-image-412 avia-img-lazy-loading-not-412 avia_image " src="...banner2.jpg" alt="..." title="..." height="831" width="1830" itemprop="thumbnailUrl" srcset="...banner1.jpg 1830w, ...banner1-300x136.jpg 300w, ...banner1-1030x468.jpg 1030w, ...banner1-768x349.jpg 768w, ...banner1-1536x697.jpg 1536w, ...banner1-1500x681.jpg 1500w, ...banner1-705x320.jpg 705w" sizes="(max-width: 1830px) 100vw, 1830px">
As you can see, the src has banner2, but the srcset contains nothing but banner1, and it’s banner1 that is displayed, because banner2 contains just the part of the image with the senior couple, not the graphics background. On smaller screens I want to maximize displaying the couple alone, without have to shrink them to include the background.
Do you know how to get banner2’s srcset in there so it renders properly?
Now, I have been experimenting with doing this, arguably, the correct way: setting the Color Section (class seniorCoupleContainer) to the background graphic image itself using CSS (which works better anyway because I want it to span the entire browser’s width), and inserting an Image media element (class seniorCouple) into the Color Section containing just the happy couple–instead of using a graphics program to combine them as a single image for bigger screens, and swapping the image of the couple with background with just the image of the couple alone on smaller screens.
.seniorCoupleContainer { background-image: url(...home-page-banner-background.png); background-size: 2881px 601px; } .seniorCouple { top: -35px; }
You can see this in a second Color Section I created on the home page below the original banner at the top. With and without the background image, it all works well responsively too:
@media only screen and (max-width:964px) { .seniorCoupleContainer { background-image: none; } }
However, because there may be other situations I need to use Javascript to swap images, can you please help me solve my original probem?
Thanks,
GaryMay 19, 2023 at 8:40 pm in reply to: Set image source filename in Javascript to swap/switch for responsive images #1407975Thanks for helping me, Mike. But it doesn’t seem to have done the trick. It still doesn’t swap out the image on any of the browsers I’ve tried (with me first clearing all cookies & cache for the website), including Firefox in Windows 7; Safari, Firefox, and Chrome on a Mac desktop; and Safari on my iPhone.
All the best, Gary
May 1, 2023 at 4:06 pm in reply to: Bottom parts of submenus hidden/inaccessible in mobile burger menu’s overlay #1406098I’m not sure what’s happened, whether one of you kind folks did something to fix my problem of clicking my Contact menu item on my iPhone not working, or something else magically happened (I did nothing to affect this fix as far as I know), but it’s now working.
So I can accept using Enfold/Avia’s method doing the burger menu, which now at least is functional on my iPhone (and I assume on Android phones) in portrait orientation. So unless anyone can help me make my method of doing the burger overlay, moving the top of it to under the burger icon (and my Search icon)–which if possible would be ideal and much appreciated–you can close this thread.
Thanks,
GaryApril 21, 2023 at 8:56 pm in reply to: Bottom parts of submenus hidden/inaccessible in mobile burger menu’s overlay #1405201Hi Yigit!
Thanks very much for replying and with your possible solution. But it didn’t work. I’ve included in the private section a permanent link to a video in my Dropbox illustrating the issue, and here is a permanent link to a public image in my Dropbox containing 6 screenshots of my iPhone (Figures 1-6) that I refer to: https://www.dropbox.com/s/mkf28lwx4jauqf4/Menus%20issues%20on%20iPhone%2020230420.jpg?dl=0. But here it is in writing as well:
To me at least, it seems Enfold implements the burger menus/submenus in a bizarre way, creating empty gaps above & below the main burger menu to handle opening up submenus: Enfold’s burger menu overlay covers the entire vertical window space (on computer) & screen space (on mobile), and they put the first menu item correctly below the burger menu, leaving a big gap from the top of the screen/window (& overlay) to that first menu item (Figure 1) (I have chosen the Sidebar Flyout Menu (Classic) as the Menu Overlay Style in the child theme’s settings). Then when the user opens a submenu, instead of just opening the submenu under it’s parent menu like every other website implementation does, everything shifts up to the top of the screen (& overlay), filling in that big gap AND going underneath the burger menu icon (& my search button) on the z-axis (z-index-like) (Figure 2). In my expert opinion (I’ve done post-graduate MSc work in human-computer interaction (UX)), that is not good for the User Experience.
So using responsive widths & heights, I decided to change the overlay margin-top & height so it’s always beneath the burger menu icon (& search button) (Figure 3), even when a submenu opens up (Figure 4). But if I do that, when a long submenu like for my Services menu opens up on a mobile device (well, I only tested on my iPhone), the bottom submenu items and the rest of the lowest parent menu items under that submenu become inaccessible, as the first part of my video demonstrates (sorry to other readers: I don’t have the video public). What’s happening is that the iPhone’s rubberband effect snaps to the 3rd last menu item, Patient Information, instead of the last menu item, Contact, making Contact and the FAQs menu item above it inaccessible for tapping. You can also see this in Figure 5, which shows that when I scroll to the bottom and let my finger go, the “rubberband effect” snaps the menu back to display Patient Information at the bottom of the screen, instead of the Contact menu item.
Just as an aside: You can see in Figure 5 that Permanent Soft Liners on New & Old Dentures is highlighted: that’s not because I chose it (we’re still on the home page as you can see in the breadcrumbs (btw, I haven’t finished the breadcrumbs margins)), but because my finder happened to gently touch it as I swiped up to scroll down. That seems to be a bug in Enfold (I see it also in the Enfold demos, but not on any other website using my phone, even other websites made using WordPress).
Back to our main problem: Actually, then another bug appears. If I attempt to scroll down a second time again, the outer window (the webpage content underneath the overlay) scrolls instead of the contents in the overlay, i.e. the menu. To me it seems overall that the code in avia-snippet-hamburger-menu.js is buggy.
So as a compromise (unless you have a solution for this issue), I thought I’d just not change the overlay margin-top & height on actual mobile devices (hover: none), but just do it on computers (hover: hover) when the user decreases the window size to a burger width (or starts at that width with his web browser window):
@media only screen and (max-width: 614px) and (min-height: 1px) and (hover: hover) { #top .av-burger-overlay { /* Start the overlay/flyout below the burger icon. */ margin-top: 195px;/*215px; >>> */ } }
In other words, leave it alone on mobile and go back to Figure 1 & 2. But doing that opens another problem I discovered. The rubberband effect works fine now, allowing me to scroll to the bottom of the menu and snap back to the bottom (Figure 6). But now when I tap the Contact menu item, instead of opening its submenu, it closes the burger menu entirely (the overlay disappears). If I open the burger menu again, scroll down to the bottom, and try tapping Contact again, the same thing happens. If I open the burger menu again, close the Services submenu, and tap the Patient Information submenu, and try tapping the Contact menu, it again does the same behavior. If I open the burger menu again, close the Patient Information submenu, and tap the FAQs submenu, and tap the Contact menu, this time it opens the Contact submenu correctly.
Any help would be appreciated.
Thanks,
GarySorry, Mike, that I didn’t send a thanks to you. Thanks for replying. Someone can now close this thread. All the best, Gary
I can’t thank you enough, Guenni007. That’s the answer I was looking for. I can do that with Text elements both in the main page layout as well as in widgets (like in my footer). Wonderful! (Wunderbar!)
(Vielen Dank! (meine Eltern kommen aus Deutschland, damit ich etwas deutsch sprechen kann–ein bisschen)
(Many thanks, my parents come from Germany, so I can speak some German–a little bit))Enfold Support: You can close this topic if you wish. Thank you.
All the best,
GaryThanks, Ismael & Guenni007. Actually, Guenni007, that’s not quite what I mean. Here’s an image showing what I mean by text wrapping around an image, both in the main body of a page and in a column of the footer. It’s a very common thing on websites, with the image usually either left or right and text going along the side and underneath (this is a permanent link that I’ll never delete): https://www.dropbox.com/s/89yr2yo3k6nm59h/text%20wrapping.jpg?dl=0
Thanks,
Gary- This reply was modified 2 years, 1 month ago by garysch37.
Thank you, Rikard & Ismael. You may close this topic. All the best, Gary
That’s too bad. Oh well. Thanks, Ismael.
All the best,
GarySeptember 29, 2022 at 9:11 pm in reply to: Magnifying Glass icon in Search form in a custom 404 page & Search Results page #1367002Yes, you can close this. Thanks, Mike. /gary
September 28, 2022 at 10:10 pm in reply to: Magnifying Glass icon in Search form in a custom 404 page & Search Results page #1366811Hi Mike!
Thank you for helping me. I should have checked my own Console to see this error! Your answer got me on the right direction. FYI: No, my root site is not an Enfold theme (only my denture6 directory is), but that’s not the issue.
It turns out that this only happens for me in Firefox (I’m using version 105.01.1 (64-bit) on Windows 7) (I don’t know if that’s the browser you were using?): e.g. Chrome (105.0.5195.127) and Internet Explorer (11.0.9600.19596) were fine. I tracked down the solution: I have to add the following to the .htaccess file in my denture6 directory:
# Fix Search Button Icon Problem: # In Firefox, when user searches for something from the body of the 404 page, the # Search button icon displays as a little box with "EB03" in it instead of the # magnifying glass (in both the header and the body Search forms). It doesn't # happen in Chrome or IE. Based on the Console errors it gives, it's because # it's not loading the "entypo-fontello" font from the Enfold parent theme (in # which "EB03" is a magnifying glass) because the CORS header # 'Access-Control-Allow-Origin' is missing. # # Note that the website address here needs to match the website address in # WordPress > Settings > General > WordPress Address (URL) & Site Address (URL) # (including any "www." (or lack thereof), but the "https" isn't needed here). # The "always" in "always set" is needed. <FilesMatch ".(eot|otf|ttf|woff|woff2)"> Header always set Access-Control-Allow-Origin "www.mySite.com" </FilesMatch>
Thanks again,
Gary- This reply was modified 2 years, 1 month ago by garysch37.
September 22, 2022 at 5:43 pm in reply to: Breadcrumbs when a parent menu item is a custom link #1366015Thank you very much Ishmael. Your code does not quite work, as it returns the breadcrumb trail as “Home > Meet Us > About” instead of “Home > About > Meet Us”, but it gave me a starting point to produce the right code. FYI: you’re also just missing a closing “)” on the ‘if’ statement. Here is my solution, which works (I’m a programmer):
function avia_adjust_breadcrumb($trail) { /* We're assuming $trail is an array with sequential keys starting from [0], each element containing the breadcrumb for a menu item from an hierarchical menu structure, with the last element having the key 'trail_end' and containing the menu item breadcrumb of the current page. This function's purpose is to manage the situation where a parent menu item is a custom link instead of a page. Because Enfold's breadcrumbs don't include menu items that are custom links instead of pages, this function checks if the current page is a child of such a parent, and if it is, inserts that custom link type of parent breadcrumb into the $trail before the current page breadcrumb. Both the check if current page is a child of such a parent as well as the link of the parent are hardcoded in this function. For example, if the actual current breadcrumbs should be "Home > About > Meet Us", but About is a link instead of a page, then $trail comes into this function as { [0] => <the link to the Home page>, ['trail_end'] => "Meet Us" }, or in other words, "Home > Meet Us". So this function changes $trail to be "Home > About > Meet Us"--i.e. returns it as: { [0] => <the link to the Home page>, [1] => <the link to the page About points to (which could e.g. be its first child menu item, Our Office Highlights)>, ['trail_end'] => "Meet Us" }. */ $parentIsCustomLink = false; $parentBreadcrumb = ""; if (is_page([36, 38, 40, 42, 44])) { $parentIsCustomLink = true; $parentBreadcrumb = '<a href="https://www.mydomain.com/our-office-highlights/" title="About" rel="home" class="trail-begin">About</a>'; } /* >>> ADDITIONAL PAGE CHECKS INSERTED HERE <<< */ if ($parentIsCustomLink) { $elementCount = count($trail); $error = false; // If something is not as expected in $trail, then $error will be set to true. $customParentKey = 0; //Just initialize it to a numerical value in case there is no 'trail_end' key in $trail. $trailEndKeyExists = false; for ($i = 1; $i <= $elementCount; $i++) { $currentKey = key($trail); if ((string)$currentKey == 'trail_end') { $trailEndKeyExists = true; $customParentKey = $i-1; if ($i !== $elementCount) { $error = true; break; } } else $newTrail[$currentKey] = $trail[$currentKey]; next($trail); } if ($error) //Then just return $trail unchanged and exit return $trail; $newTrail[$customParentKey] = $parentBreadcrumb; $newTrail['trail_end'] = $trail['trail_end']; unset($trail); return $newTrail; } else return $trail; } add_filter('avia_breadcrumbs_trail', 'avia_adjust_breadcrumb', 50, 1);
Thanks again,
GarySeptember 7, 2022 at 5:51 pm in reply to: Breadcrumbs when a parent menu item is a custom link #1364237Thanks, Ismael.
But that doesn’t solve the problem of “About” not being in the breadcrumbs. In fact, I already change the color of the About parent menu item when any of it’s children are active.
What we’re really looking for is overriding some PHP or even JavaScript functions in some fancy way to insert the parent menu items that are custom links instead of pages into the breadcrumbs. I’m a computer programmer/analyst myself and could in theory do it. But frankly it would just be too much work for me to figure it all out. I was just hoping you guys have already run across this issue and have a solution in your pocket.
If none of you do, it might just be best for me to just hard-code the breadcrumbs in HTML on each page.
Thanks,
GarySeptember 6, 2022 at 5:37 pm in reply to: Breadcrumbs when a parent menu item is a custom link #1364089Thank you, Ismael, for your reply. I appreciate your help.
The problem with your suggested parent solution is that there are no actual pages for most of my parent menus, as they are custom links pointing to their first child. For example, the About parent points to its first child, Our Office Highlights. So I can’t set the Parent Page of any of the child pages (e.g. Our Office Highlights, Meet Us, etc.), since the About page does not exist (even typing into that text box, “About”, doesn’t work, since it wants you to choose from the dropdown of existing pages).
Thanks,
GaryJune 16, 2020 at 6:45 am in reply to: Header displays for a split second too wide (menu positioning issue) #1222921Hi Mike! Yes, you can close this issue. I learned a lot in trying to solve this problem. Thanks again for your help. All the best, Gary
June 14, 2020 at 7:10 am in reply to: Header displays for a split second too wide (menu positioning issue) #1222451Hi Mike!
Thank you, that does work. But I prefer to keep Page Preloading off, as it looks weird, with the page not loading in pieces like with most websites, but just blank and then it’s all there at once after a time period. If I didn’t find a solution to the FOUC (flash of unstyled content) problem, your Page Preloading solution would have been fine, and I appreciate you finding that solution and giving me that option.
However, I did end up finding a different, more direct solution today, that also looks better. In my Custom CSS file for my child theme, I hide the main menu:
.responsive #top #header #header_main .main_menu { display: none !important; }
Then in my custom functions.php file for my child theme, I display (unhide) the main menu after the whole page has loaded:
add_action('wp_head', 'fouc_protect_against'); function fouc_protect_against () { ?> <script type="text/javascript"> jQuery(document).ready(function($) { $('.main_menu').show(); }); </script> <?php }
This seems to work satisfactorily! Hooray!
Speaking of FOUC problems, in case any one else is searching on this problem, I discovered another FOUC issue with the logo, but only in Firefox; all other browsers are fine. There is a FOUC problem in Firefox when loading the logo image: the ALT text displays for a split second before the image displays, giving a FOUC-like flash effect that is ugly. Maybe the problem shows up for every image: I didn’t bother investigating. It only happens in Firefox and is a known bug it turns out. However, a solution like I found for the main menu doesn’t work. But I ended up using the industry accepted solution for this problem, to be added to my Custom CSS file:
img:-moz-loading { visibility: hidden; }
Thanks again, Mike.
All the best,
GaryJune 11, 2020 at 1:22 am in reply to: Header displays for a split second too wide (menu positioning issue) #1221471Thanks, Mike. That’s funny: that’s the exact solution I tried and mentioned above (the “FOUC approach”)–well, Stefan’s solution, not Adam’s (because I don’t know how to do Adam’s inside WordPress), as you can see in my commented out part in functions.php. The investigation continues.
-
AuthorPosts