论坛

由用户创建的信息 simblen
06 April 2017 11:16
Hi everyone,
I think lukes suggestion is a good one but Im unsure how to do this. I did a quick cut/paste and amend and the code could be something like this

document.getElementById("declare_anchor").addEventListener("hidden", declare_anchor.scrollTop=0);

do you think this would work as everytime the div is "hidden" it would reset the scroll to top.
Secondly where would I even place this javascript in the head of my html or a new javascript file called from the head

many thanks, for your support and suggestions
06 April 2017 11:00
Hi Luke
im not sure I would know how to do that, as I really am a newbie when it comes to javascript and I have been doing a lot of cut and paste and hours of fiddling.
Thanks for the suggestion, I will see if google has an answer with regards to the event listener, you never know I may get lucky
05 April 2017 19:25
Thank you Dmitry for replying so quickly.
unfortunately the divs containing the content are created through a javascript function based on the custom anchors script code. These are all created as the app loads via javascript and then they are made visible from buttons within the 3d scene using empties/general anchors.
My issue is that once you have looked at the divs, hide them and then re-open them later they are still set at the last scroll position.
What I would like to happen is that everytime I show the div from the 3d scene I would like them to start at the top

Thank you again and if you have any more suggestions that would be wonderful
05 April 2017 15:00
Hi everyone,
cannot thank you all for the help with my project.
I have been using the custom anchors on my screen to create pop-up divs that show information.
This information is rather long and I have set the div to scroll all functions great.
Unfortunately when you open a div and scroll down, then open another and finally go back to the first div it remembers where you left the scrollbar.
What I would really like to happen is that when you open a div it always starts at the top.
I have tried using scrollTop (0) code on the customer anchor javascript but it does not do anything.

My code looks like this:
var declareslide_div = document.createElement("div");
declareslide_div.id = "declare_anchor";
declareslide_div.innerHTML = "<p class='title'>…Content goes here..</p>";
declareslide_div.style.overflow = "scroll";
declareslide_div.scrollTop = "0";

Any suggestions on how I can solve this.
Many thanks for all the support
29 March 2017 11:57
Morning Evgeny,
I cannot thank you enough, that worked perfectly by switching off the dds_available flag.
This is a great relief and many many …..many thanks
You amazing man
Simblen
28 March 2017 19:43
H everyone,
Looking at the local and the uploaded console for this file.
Somewhere it is adding in .dds between the file name and the "?v=28032017160938" see below

CSAapp-anchors/assets/close.png.dds?v=28032017160938

If I try the error link and remove the ".ddr" on the web browser it then loads the file correctly, but where is this coming from I have no idea.

Any help appreciated
28 March 2017 19:27
hmmm,
ive managed to make it run on the local preview again and none of the links to my textures are a problem but as soon as I build and deploy this it show a load error.
See attached file for local correct load of assets

Im getting very frustrated with this

kindest regards
simblen
28 March 2017 14:40
here is a small snapshot of the error code.
I dont know where these strange number png assets are being created as these are not the names I have given them
28 March 2017 14:36
Hi Evgeny,
I have gone through all my textures and placed and linked them into the assets folder within the projects folder.
I am still getting no textures and lots of 404 errors.
Also my local preview now seems to not show the textures either.

I am trying to use the custom anchor code snippet and I noticed this bit of code

var APP_ASSETS_PATH = m_cfg.get_assets_path("CSAapp-anchors");

followed by this:-

m_data.load(APP_ASSETS_PATH + "custom_anchors.json", load_cb);

is this where the problem is because this seems to relate to the assets and on the turorial I followed (https://www.youtube.com/watch?v=GtrsMEh5VNI) this didnt seem to be used.

Any thoughts or guidance would be gratefully received
simblen
27 March 2017 12:30
Thanks evgeny for the reply.
I looked at the app in the browser and yes there are a lot of 404 for the textures. I will go back through my textures and make sure I link these to the images in the assets folders.
Hopefully that will solve the issue.
Many thanks