tontof / kriss_feed

A simple and smart (or stupid) feed reader
280 stars 54 forks source link

Portrait / landscape mode doesn't display the same article #413

Open Nono-m0le opened 5 years ago

Nono-m0le commented 5 years ago

Hi tontof,

Me again :D I realized that when I turn my mobile on landscape mode (usually to see embedded video within an article), the article displayed isn't the same as the one I was reading in portrait mode. I'm using android 7.0 with FF 64.0.2 It also work on only text article. Just flip your phone one way and back. You always have to scroll a bit to see the article you were reading.

tontof commented 5 years ago

I can not test as I don't have a device with orientation change on hand but something with this custom code should do the trick:

var stop = 0; var sh = 0; document.getElementById('main-container').onscroll = function(evt) { stop = evt.target.scrollTop; sh = document.getElementById('main-container').scrollHeight; }
window.onresize = function(evt) { document.getElementById('main-container').scroll({ top: document.getElementById('main-container').scrollHeight*(stop/sh) , behavior: 'smooth' })}

I've tested with onresize event but you may have to change with onorientationchange https://developer.mozilla.org/en-US/docs/Web/API/Screen/onorientationchange hope this help...

Nono-m0le commented 5 years ago

Please explain me what to do like I'm 5 ^^

tontof commented 5 years ago

Don't you have a custom js file already ? If not just copy/paste the inc/script.js and add the custom lines above at the end of the script.js file to try

tontof commented 5 years ago

create a inc directory and add the script.js file inside the inc directory

Nono-m0le commented 5 years ago

ok, like I'm 7 then :D I tried .. (only had a user.css) unsuccessful :(

Not sure if I did something wrong ... but it also removed all my items :'(

tontof commented 5 years ago

Ooops I guess you did something wrong as I don't think what I told you can remove your items... Sorry for that. Can you send me a link of your KrISS feed instance so that I can look if your modification seems to be OK

Nono-m0le commented 5 years ago

Sent by email :-)