I use a sticky sidebar on my website - https://geek.hr/znanost and i have DFP ads in it.
The problem is that the right top sidebar ad will load and then disappear quickly.
This happens randomly in all browsers, but almost always in Edge browser.
Does anyone know what the problem is?
Thanks
I've played with your site a bit and have found the following:
When nothing is displayed the outer container has a correct size but an internal ad has 0 height hence nothing is shown. I've examined the inner creative contents and it looks like it's trying to load something related to flash. It may seem that it 'disappears' because usually flash banners do load an intermediate image first and only then replace it with a .swf file.
When other (non-flash) creative wins the auction all looks fine hence the adtags setup looks good
So I would conclude that something is wrong with flash creatives rendering more so because you're using SafeFrames
Many sticky sidebars work by cloning your original sidebar, which can break unique elements that have events attached to them.
If your sticky sidebar has a unique class/ID that distinguishes it from a non-sticky sidebar, then you can just wait for it to appear before loading the ad:
<div id='sidebar_ad'></div>
<script>
function load_sticky_sidebar_ad()
{
let sidebar_ad_container = document.querySelector('#sidebar_ad');
if (sidebar_ad_container === null || sidebar_ad_container.closest('.theiaStickySidebar') === null)
{
(function(){window.setTimeout(load_sticky_sidebar_ad, 50);})();
}
else
{
googletag.cmd.push(function()
{
googletag.display('sidebar_ad');
});
}
}
(function(){window.setTimeout(load_sticky_sidebar_ad, 50);})();
</script>
Some modification might be needed depending on how your exact sticky sidebar works, but the general logic there should work for just about any sticky sidebar.
Related
Here is the desired outcome I'm looking to achieve by scrolling using react-scroll-parallax.
On Mobile browser
View web browser example here
Description
I want to create a website with the parallax affect shown above. The key elements being a website build in react containing three pages.
While scrolling from Page 1 to Page 2 I want the mobile device mock to start halfway on the screen (as to avoid the other content of page 1), then move to being basically centered.
While scrolling from Page 2 to Page 3, the website and components stick and once again act like a normal website scroll.
Additionally, during the scroll from Page 1 to Page 2, I want the content inside the device mock to scroll as well.
What I tried
For starters I was able to get nearly the affect I wanted by using a div with it's z-index and absolute position set, and parallax on translateY of -50, 125.
<div className={"absolute z-10 w-full"}>
<Parallax translateY={[-50, 125]}></Parallax>
</div>
The problem became however when I wanted to place content inside the div. Having another div within the parallax that also had z-index set seemed to mess with the parallax affect.
Important notes
Content inside device mock
One issue I found that was tricky was trying to place the content inside the device mock. I want a parallax both on the device mock itself, and the content within it.
I'm not entirely sure how I should crop the content inside the device mock.
The device mock svg frame and device mock mask can be found here if you want to give it a try
Device mock svg and mask
I tried imgs with various z-indexes, masking the div with an svg mask, using image backgrounds. Nothing is quite getting the preferred outcome.
Scaling of device mock
I want to make sure this works well on both mobile and browser. With that said I was trying to use margins to scale the device mock but I had a hard time with trying to then correctly get the mask to work for the content within the mock.
I'm not sure if using dedicated width and height sizes would be the ideal way to go, but very open to suggestions! It seems hard to scale the device frame and the mask properly.
Parallax of device and parallax of device content
I want the content inside the device mock to be html so that I can change it more than just an image. That being said the most important feature I want is for both the device and the content inside to have a parallax scroll affect.
Summary
I know this is a bit much for a quick simple stack overflow issue, but I've been trying a lot to get this to work and just can't seem to nail down the little details correctly. I sincerely appreciate all help and suggestions and if there is anything else I can provide please let me know!
The trickier part of the request was blowing up the <svg>, adding new <path /> and <clipPath /> for the color swap inside the phone mock.
Eventually I got it working here. The part linking the clipPath transition to the scroll progress looks like this:
const [y, setY] = React.useState(1739);
const onProgressChange = React.useCallback(
(a) =>
setY(Math.max(Math.min(1739, 1739 - ((a - 0.24) / 0.0018) * 17), 36)),
[setY]
);
const { ref } = useParallax({
translateY: [0, 185],
onProgressChange
});
The 1739 and 36 are max and min values for the translation and they are strictly related to the svg's viewBox. The other values allow tweaking the start, end and speed of animation, with regards to overall scroll progress.
This, together with some CSS, took care of binding the right animations to the correct scroll progress.
Feel free to tweak it some more, especially if you add more markup.
The other thing I wanted was a function activated shortly after scrolling, which would snap the scroll to certain positions. Namely, to the .page elements.
I used gsap's ScrollTrigger plugin for the task, for multiple reasons:
I'm somewhat familiar with it (used it before)
it's performant, light and non-obtrusive (basically quits when it detects another user scroll)
listens to all relevant events (touch, mouse pointer, keyboard) without me having to make sense of them, providing a unified interface.
uses inertia (if you scroll down faster from page 1 it will scroll past page 2, directly to page 3 - other scroll plugins limit you to having to scroll once for each page change)
works well on mobile devices
There are other libs/plugins out there for the task, you don't have to use gsap (although I do think it's awesome). If you end up including it in your project, make sure you comply with their licensing (which is not MIT).
By the way, my first choice for the parallax effect per-se would also be gsap, as their timelines provide a lot of flexibility and options.
Their most advanced stuff is reserved for subscribers, but even if you limit yourself to the free plugins, you're still getting more than from alternative libs/plugins, IMHO.
See it working.
I'm the webmaster of http://concretetoboggan.uwaterloo.ca and a first-time web designer, so I sort of stumbled my way through CSS. I've been having a peculiar problem.
If you go to the link (for the first time), the page stalls for a noticeable 2-3 seconds on the main slideshow before loading the rest of the page. It's really distracting and seems easily fixable, but I can't fix it.
Here's the Net timeline of the site, as you can see, Firebug shows a mysterious gap.
The sequence of events that the page performs is (supposed to be):
Load jQuery at start of page
Load page
Display the first image of slideshow (the rest of the images are loaded into divs with a 'hidden' class, presumably the browser does this async)
Continue loading page
Remove 'hidden' class on DOM ready
Load jQuery bxSlider on DOM ready
Each of the slideshow slides is composed of a div with an img tag inside and a caption bar sub-div absolutely positioned at bottom:0.
I've tired the following optimizations, which helped slightly-to-not-at-all:
Remove the table that is loaded below the slideshow (seems to speed things up a bit, still stalls)
Reduce the size of the images loaded (speeds things up a bit, still stalls)
Put the img 'src' in a 'dsrc' attribute and then reassign it on DOM ready (still stalls)
Put the images in background: CSS of div (unwanted layout issues)
Oftentimes, the 'stalling' is due to the page not having sufficient information to calculate the layout, because it doesn't know the dimensions of the images until it's loaded them.
If your happen the know the dimensions of your images, you can avoid this particular problem by changing your <img> tags from...
<img src="myimage.jpg"/>
...to...
<img src="myimage.jpg" width="640" height="480"/>
...or whatever they happen to be.
However, there are a zillion other reasons why the page might be stalling.
Update
Another thing that you can sometimes do to speed things up: if you're loading a script with the <script> tag which isn't required to render the page, but is only used to process subsequent user input, you can defer the script loading until after the page has rendered by adding the defer attribute, e.g. change...
<script src="http://someslowsite.com/somescript.js">
...to...
<script src="http://someslowsite.com/somescript.js" defer="defer">
...but if you need the script to render the page, then this won't be possible. If you think the user will be able to load the script from your site faster than a third-party site, then make a copy and host it yourself.
I have a weird problem occurring with a web page being viewed in google chrome. When viewed in ie9 / safari the embedded youtube video works fine but for some reason in chrome it just displays a black box on page load. The weird thing is the moment the page is interacted with, ie. the user scrolls down, the video will display correctly. I'm not sure what's going wrong.
The page in question is: http://core.slnmedia.com/inspiration/
There's a script on the page that will detect the width available to the right of a large tile and if there is sufficent space, the pop-out panel will display on the right. If not, the panel will display on the left. If you resize your browser window so that the 'bevis marks' tile sits at the top right corner of the screen and only has a small amount of space available on the right, then click on it, you'll see the effect I'm talking about.
The javascript function that's changing the position of the tile is below:
$('.large-tile').hover(function() {
$(this).find('.bw-photo').hide();
$(this).find('.inspiration-detail-wrapper').show();
$(this).css("z-index", "2");
var profile = $(this).find('.inspiration-detail');
if(profile.find('.content').text().trim().length == 0) {
showData($(this).attr('id').substring(1, $(this).attr("id").length));
}
// **Depending on how much window space is available, position the panel on**left/right
var available = $(window).innerWidth() - ($(this).offset().left + 300);
if(available >= 412) {
// If enough space then show panel on right
profile.css("left", "320px");
}
else {
// Otherwise attach left
profile.css("left", "-368px");
}
profile.show();
$('.scrollbar-wrapper').tinyscrollbar({ size: 252 });
},
function() {
$(this).find('.bw-photo').show();
$(this).find('.profile').hide();
$(this).css("z-index", "1");
$(this).find('.inspiration-detail-wrapper').hide();
});
The weird thing is that the line profile.css("left", "320px"); is what causes the trouble. If you don't include this line then the video displays correctly. For some reason the positioning causes the video not to display correctly.
I hope I've explained the problem correctly - does anyone have an idea of where I'm going wrong here? It's driving me nuts!
Thanks
I was having trouble after a Microsoft update. I cleared my cache and cookies for the last week and everything works fine now.
This worked for me:
<iframe allowfullscreen frameborder="0" height="315"
src="http://www.youtube.com/embed/A3pIrBZQJvE?wmode=transparent" width="420"
wmode="Opaque"></iframe>
Source
I'm developping a card game.
I have an ASP.NET page with some 52 small images (the cards), say 300 Kbytes in total.
When the page loads for the 1st time the effect is ugly: User can see each card being loaded in turn.
Moreover, only some images are to be displayed after page loads.
Hence the big issue:
I can't make the images hidden from ASP.NET since if hidden they are simply NOT rendered within the "dynamically generated" aspx page!
And of course when I use a js function fired from windows.onload event, then the user will see all the images before I can hide them in javascript!
The dirty way would be to create a Div that would be displayed in front of all other objects since I use absolute positioning.
I'm quite sure you all gurus, you have better ideas!...
If all of the images are enclosed in a single element (say, a div) then you can set its CSS to display: none by default so that even during page rendering it won't show to the user. Then, when all of the content is loaded, display it to the user. Something like this:
<style type="text/css">
#imageContent { display: none; }
</style>
<div id="imageContent">
<!-- your images are here -->
</div>
<script type="text/javascript">
// assuming jQuery because, well, come on
$(document).load(function() {
$('#imageContent').show();
});
</script>
Now, this makes no guarantees that it won't take a long time for the images to load, resulting in the user not seeing any of them for a while. And if some of them fail to load then I'm not sure what would happen. I imagine the event will still fire once the DOM gives up on trying to load the failed resources.
Naturally, you'll want to style around all of this so that the transition from no images to all images is a smooth user experience. If it takes a few moments then the user may already be interacting with the page when the images suddenly load and move stuff around (I haven't seen your page, so maybe that's not an issue.)
So you'll want to test something like this one a known slow connection or with known broken images to see how it all behaves.
I have a small idea of how such things oftenly done in different jQuery libraries.
The idea is to pack all the cards in ONE image and show different patrs of the image by setting this image as a background of the div and change offsets.
Google does so, for instance. Take a look:
http://www.google.ru/images/nav_logo83.png
This is the elements used at SERP
In an ecommerce site, I would like to display number of items in a row according to browser width, but minimum will be 4 items. Just like what has been done in Amozon site, if you try to browse amozon.com, try to maximize and shrink your browser, you will find that number of items display in [More Items to Consider] section is according to your browser size. It is smart enough to know when it should fully hide or show an item, no partially visible item forever.
Anyone know what is this technology called? Any idea how this can be done? Thanks in advance.
You can do this with float elements in a div with overflow:hidden. I'll jsfiddle a proof of concept for you.
JSFiddle:
http://jsfiddle.net/WLEzw/
Make your browser window bigger and smaller and you will see more and less pears.
That is just CSS based.
An example of what you want to accomplish from a friend website redesign
shrink and wide the browser so you can see the effect
You can also use JQuery to moniter whether browser window is resized, through $(window).resize function. And you'll have to call details of the products shown either using Ajax or with iframe by reloading the page within iframe with more products.
The code to be written inside browser's resize method will be as follows.
$(window).resize(function() {
//Your code on resizing the browser.
});