Section larger than viewport is not scrollable and jumps back to the top - jquery-scrollify

I am having a problem with jQuery-scrollify. I have a header section which is a 100vh heigh and works without any problems. The next section is taller than the viewport. It scrolls down to it normally, but it prevents you from scrolling further down to look at the elements in that container. When I use the scrollbar and basically force it to scroll down, it snaps back up to the upper edge of the section.
I have tried changing the setHeights variable but that doesn't help.
The weird part is, that when I resize my window or open the Chrome inspector, it fixes itself. Because of that I tried calling the update method in the afterRender function, but that didn't work. Although it does work when I call the update method from the console. When Scrollify is installed I also get an issue where my footer is in the middle of the section above it. I do think that this issue is a result of the same problem as the scrolling , as that fixes itself when I update scrollify as well.
These are my settings:
section: ".scroll",
sectionName: "section-name",
interstitialSection: ".footer",
easing: "easeOutExpo",
scrollSpeed: 700,
offset: 0,
scrollbars: true,
target:"html,body",
standardScrollElements: false,
setHeights: true,
overflowScroll: true,
updateHash: true,
touchScroll:true,
before:function() {},
after:function() {},
afterResize:function() {},
afterRender:function() {}

Related

What would prevent capybara/selenium from hovering over a visible element?

I am writing automation tests for a webpage. I can't share any specific details, so all I'm looking for is some general brain-storming to help me figure out what is causing the problem. A long-shot, I know, but I've become obsessed with this problem.
There is an element with id="troublesome" on the webpage. On manual testing, hovering over #troublesome will cause it to disappear and something else pops up in its place (as it should). I'm trying to verify that the pop-up occurs on hover using automation testing (Capybara, selenium driver, ruby). However, no matter what technique I use, hovering doesn't work.
troublesome is visible upon visiting the page. It is not cut off by screen size. Capybara has no trouble finding it and reading its text and attributes. i.e. A regular ol' find("#troublesome").text will return the correct text.
However, I cannot use Capybara to click on #troublesome without executing javascript.
i.e. find("#troublesome").click won't do anything (it won't throw any errors either). I must use find("#troublesome").execute_script("this.click()") to click on it.
But I don't need to click it. I just need to hover over it.
Using Capybara:
find("#troublesome").hover --> will not work. No errors thrown either. Test just continues until it fails because it fails to find the expected result. Telling ruby to sleep(however_many_seconds) doesn't help.
Using Selenium:
page.driver.browser.action.move_to(find("#troublesome").native).perform --> this doesn't work either. Again, no errors thrown.
Using trigger:
find("#troublesome").trigger(:mouseover) --> doesn't work because selenium driver doesn't support trigger (and I don't want to use another driver).
Using jquery:
Won't work. Website doesn't use jquery
Attempting to use javascript to force :hover to be true on element doesn't work:
mouseHover = 'var x = document.createEvent("MouseEvent");
x.initMouseEvent("mouseover", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
document.getElementById("troublesome").dispatchEvent(x);'
page.execute_script(mouseHover)
(I can change mouseOver to click, and it'll click though!)
Apparently, mouseover is not 'trusted' by browser (but click is), so kinda useless to have that as an option, isn't it?
I've tried all of the above by working within a within("#id") do... end block. Doesn't make a difference.
I've even tried unconventional means to get the mouse over #troublesome:
find("#troublesome").right_click --> the mouse will be DIRECTLY over #troublesome, right-click, and a menu will pop up RIGHT OVER the element!!!!!!
So CLEARLY, the mouse IS hovering over #troublesome during my automation test, yet it's not registering on the browser. The website is not bugged. Hovering works when I do it manually.
I can find other elements on the webpage and hover over them just fine. In fact, I've even tried putting the mouse over another element, then moving it from there to #troublesome like so:
page.driver.browser.action.move_to(find("#somethingElse").native, 1200, -50).perform
That doesn't work, but if I adjust the coordinates to a third element just below #somethingElse, this will trigger the third element's hover state, so clearly this strategy can work in principle and practice, yet not for #troublesome!
Note that #somethingElse and the 'third element' exist on a div that is at the same 'heirarchy' as the ancestor div of #troublesome.
There are iframes on the webpage, but #troublesome is not on the iframe.
There are random script tags inserted all over the body of the webpage. I don't know what those script tags are doing as I can't see the code.
#troublesome has become my Moby Dick.
This whale is driving me nuts. I've invested too much time into it already. I can't give up now or all those hours of toil would be for nothing.
Please help.
Thank you.
find("#troublesome").hover
page.driver.browser.action.move_to(find("#troublesome").native).perform
find("#troublesome").trigger(:mouseover)
mouseHover = 'var x = document.createEvent("MouseEvent");
x.initMouseEvent("mouseover", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
document.getElementById("myDiv").dispatchEvent(x);'
page.execute_script(mouseHover)
page.driver.browser.action.move_to(find("#somethingElse").native, 1200, -50).perform
No error messages other than standard capybara/rspec failure log because it failed to find the element that was supposed to pop up upon hovering over #troublesome
The problem you're running into is because the '.hoverme' element in your example at https://jsfiddle.net/pwo7zuL2/1/ has a size of 0x0 px (this is also why you couldn't click it). The size is 0x0 because it only contains absolute positioned elements which don't technically count when calculating the auto size of the parent. If instead of attempting to hover over the .hoverme element you hover over the visible absolute positioned child (which actually has size) of the element the hover will work correctly (which is what you are actually doing when you do it manually in your example).
find('#next').hover
I now know the problem, and I have a solution (albeit a hacky one).
The problem is due to an iframe which covers the full screen. This blocks selenium from being able to hover over #troublesome even though #troublesome is not within the iframe and #troublesome's z-index is set to a high number (thereby forcing it to be at the top layer).
Manual hovering works, but hovering with selenium fails. I believe this is a bug, so I have reported it on selenium's github.
One solution that works is to use javascript to force the iframe to shrink, then hover (which should work now), then use javascript to return the iframe to full screen (so as to not affect other aspects of the test).
shrink_frame = 'document.getElementById("#frame").setAttribute("style", "width: 100px; height 100px");'
page.execute_script(shrink_frame)
This is not an ideal solution because it is obviously not how a real user would interact with the webpage, but it's acceptable given that this is due to a selenium bug and that manual testing works.

Is there a way to stop a flare animation from looping?

I am making an application where I'm trying out flare animations. I have a custom animation and it works as intended. Except that the animation is looping repeatedly whereas i want it to play once and freeze the last frame.
I've tried using the FlareControls() class but I haven't had any luck. I've also tried setting the callback param to a function that sets "paused" to true but that didn't work either since isPaused is a final variable. I've also tried the callback parameter to print test in order to indicate that the animation was finished but it didn't work
FlareActor(
"assets/flares/checkmark.flr",
animation: "Checkmark",
alignment: Alignment.center,
shouldClip: false,
fit: BoxFit.contain,
snapToEnd: true,
callback: (value){
print("test");
// flare.animation = "idle";
},
With the snippet included, I'm expecting a message on the console to print test when the loop's finished but to no avail
On the Flare website when creating your animation, click the button next to your animation timeline in the bottom left, so that it is disabled. Now you export the new file and replace the old one in your assets.

NormallScroll and fitToSection

I have two sections. Second section has very big height, so i marked it as "normalScrollElements". And i would like to have fullpage.js appearence between this two sections and having default browser scrollbar. Disabling fitToSection made it close, but only default browser scroll is working :(
$('.scroll-sections-wrap').fullpage({
sectionSelector: '.scroll-section',
scrollBar: true,
easing: 'easeInOutCubic',
css3: true,
easingcss3: 'ease-in-out',
scrollingSpeed: 900,
fitToSectionDelay: 500,
responsiveHeight:650,
responsiveWidth:1000,
fitToSection:false,
normalScrollElements: '#second-section-id',
verticalCentered:false,
});
Second section has very big height, so i marked it as "normalScrollElements".
That's not the way you are suppose to use normalScrollElements. Normal scroll elements is for small elements that needs to use their own scroll.
normalScrollElements: (default null) If you want to avoid the auto scroll when scrolling over some elements, this is the option you need to use. (useful for maps, scrolling divs etc.) It requires a string with the jQuery selectors for those elements. (For example: normalScrollElements: '#element1, .element2')
You should be using scrollOverflow:true:
scrollOverflow: (default false) defines whether or not to create a scroll for the section in case its content is bigger than the height of it. When set to true, your content will be wrapped by the plugin. Consider using delegation or load your other scripts in the afterRender callback. In case of setting it to true, it requires the vendor plugin jquery.slimscroll.min and it should be loaded before the fullPage.js plugin.

Firefox scrollbar resets incorrectly

I've come across a problem in Firefox browser. It's likely a bug, but maybe someone knows a workaround. The problem is demonstrated in the following JSFiddle: http://jsfiddle.net/F5tdB/ This has been tested on Firefox 12.0, 15.0.1, 16.0.1.
To explain it in words... You have to follow this sequence of events:
Get an element with overflow:auto and some overflowing contents, then scroll it a bit;
Hide the element (display: none);
Remove contents
Show the element (it's empty now)
Re-add the same contents (it's scrolled now, just as it was before)
Reset scrollTop/scrollLeft to 0 via Javascript.
As a result, the contents do get scrolled to the proper position, but the scrollbar stays as it was, which is clearly wrong.
Is there any workaround to this short of removing/re-adding the element instead of just hiding it?
In testing I discovered that if you set scrollTop to any value other than 0 (or its current value) then it updates the scrollbar correctly. You can then immediately set scrollTop to 0.
Particularly as you have a test case you should of course file a bug in Bugzilla.
Solution is add the animate method, so use:
function resetScroll(){
$(document).scrollTop(1); // removes the impression of animation
$('html,body').animate({scrollTop:0},'fast','linear');
}

Cluetip popup windows getting cutoff by browser

jQuery('area').cluetip({
sticky: true,
positionBy: 'auto',
width:370,
dropShadow:false,
closePosition: 'top',
closeText: '',
activation: 'click'
}
Straight to the point: when i click to activate popup windows, it's always at the right handside of where i click, even when there is not enough space. So for those it only shows some part to the cluetip as the rest is getting cutt off by browser window??
I am totally new to php and cluetip...
About the only thing that can be done, by the looks of things, is use the positionBy parameter. But it doesn't work really in determining if the tip is cutoff, I have tried many cases myself.
The options are auto, mouse, bottomTop, fixed, but none of them work really, they all get cut off.
The only solution I found myself was to use fixed and set top and left manually and always have it in the same place.
j('.areaH').cluetip({
positionBy: 'fixed',
topOffset: 200,
leftOffset: 100
});
Unfortunately though you are stuck at that place holder. I guess you could take the action and to each thing that calls a cluetip call a wait segment of 1 second then re-position the cluetip window using jQuery.
This would be in an onHover event set off by the thing that calls the cluetip separately. But that's about it. I have tested this myself on FF and Chrome and in both it cuts off.
http://plugins.learningjquery.com/cluetip/#features
In the onHover event you can always use another jQuery plugin that waits for an element to exist then re-position, what you can do is in each element have your own attr that has the new position, or just call the elements left and top position using jQuery and move the Cluetip window to that +20 in each direction.

Resources