Remove scrolll after page load - javascript

I have wordpress site in which after complete one step of form
it redirect to second part but because of id added in URL it scroll
down where page id in hidden. But i want to prevent scrolling and
look like this
After complete first step it scroll down page also want to remove
this without change in url and hidden id.
Any Possibility by JavaScript?

I Have Solved It myself.It's HTML issue.

Related

Two active links at the same time on wordpress

I have this "problem" with my website that is, when i am at the Home Page i have another link of my menu that is not a page, who stays active because i used an anchor on that link.
Basicaly i added the https://dama.ci/notre-histoire url to that link so when i'm on another page of my website i can actually click on the link and go back to the home page where the anchor is attached and this is what causes the problem.
So my question is, since that link on the menu isn't a page what could i actually do to have the link activated only when it's clicked ?
Is there another way to achieve what i'm trying to have on the website ?
If you want to check the site here is the URL
You can try with another way, you should remove current-menu-item class from that li onload using js i have added sample js code for you
$(document).ready(function() {
$(".menu-item-538").removeClass("current-menu-item current_page_item");
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
Change your “Services” link URL from:
https://dama.ci/#inspiration
to simply:
/#inspiration
i.e. remember to add your domain’s trailing slash when you use the full or root-relative URL in your links.
When you say two menu items get highlighted at the same time, you mean “inspiration” and “Home”? If yes, you’ll need to make the “Home” link point to the top of the homepage (e.g. with a URL like /#inspiration). Otherwise, it gets highlighted by your theme as the current page.

Reload iFrame, wait till it is loaded, open URL in same iFrame

so when it comes to Javascript, I have no idea what I am doing.
I have a main page, with two iFrames. The main "content" iFrame holds the main content, in this case, the results from a MySQL database SELECT. The bottom iFrame is used to add rows to the same table.
When the 'add row' form is submitted from the bottom iFrame, I want the 'content' iFrame to load the list of results, and scroll to the newly added result.
I use
Currently, the only way to make this work that I have found is echo-ing the following code once upon successful row entry:
parent.document.getElementById('content').contentWindow.location.reload();
parent.document.getElementById('content').src = '../pages/results.php#".$id."';
The $id variable is set with $mysqli->insert_id;
The above code works, but it's obviously bad coding, on slower connections, for example, I can imagine the browser will fail to change the src as the reload action is still performing.
So, what can I add to my code, or what can I change my code to, to make the javascript either:
Reload the 'content' iFrame to show the new row and then navigate to the anchor to scroll the user to the newly created row. or
Do all of that in one simple action (I've found just using the bottom line of the two lines on it's own doesn't work, so the reload seems necessary to me at the moment.)

How do I open a link to specific div in cordova application

I'm currently working on a mobile application using Cordova.
When I click on the 'reviews' button on one page, I want it to open up the next page (which shows more about that particular company) and automatically scroll down to the 'reviews' div on that page.
I've tried adding a scrollTop within the onclick function, adding a # to it (this breaks the link completely) and many other different things.
How can I do that? Any help would be greatly appreciated!
***Edit
a onclick="' + showpage + '"
this url is bring created from json info that is being brought in depending on certain criteria.
The page that it is on is a list of businesses, then if you click on the name, it goes to a page about that particular business. Currently when you click on the reviews, it also goes to the particular business but I want it to load the business page then automatically scroll down to the reviews div (This is being created dynamically as the page is loaded).
div class="star-review' <-- this is the div that I'm wanting it to scroll into position to.
Avoid href in a tag....
Use this simple workaround in JavaScript
<a id="scrollToTop name="scrollToTop" value="Send">
Scroll To Top
</a>
<script>
$("#scrollToTop").scrollTop(
$("#scrollToTop")[0].scrollHeight);
});
</script>
The href was being built into a function and then showpage was spitting that link out, I solved the problem by rebuilding the href without showpage and then I was able to add my #reviews to the end of it. :)
Cordova creates application using single page architecture, so it creates a link between page using hastag.
data-role="page" id="mypage"
In your tag you need to pass data-role as page, and you need to pass its id.
When creating link on the page, you need to write link tag as mentioned below:
My Page Link
Thanks
Amit

Link clickability with jquery

I have a form that is built into layerslider, and in order for a user to get to the next page they have to fill out the current page until it is valid and then they are allowed to move on.
At first I did this by showing/hiding the button but it was confusing my users.
What I'm doing now it changing the opacity/clickability based on if the page is valid.
My problem is that while I can change the opacity no problem I'm having a difficult time getting the buttons to be unclickable (deep link i.e. #NextPage).
My question is, is there a clean way to do this using jQuery, or will I have to put a div over it and show/hide that?
****** EDIT *******
I am using links to a deep link, not html buttons i.e. <a href="#page2">
I need to make the anchor unclickable/clickable
To disable the button, simply use:
$('#YOURBUTTON').prop('disabled', true);

How to make page autoscroll to DIV onload

I have a quicklaunch (bookmark list if you'd like) which will send the user to different pages with lots of text. So I want them to be sent to the specific paragraph.
Is it possible to make a page autoscroll to a specific DIV onload and how?
I'll live without the animation. If it can just go to it directly that'll make my day. Like when you have an <a href="#SomeId"> tag and when you click that anchor it sends you to that div.
Edit: If the user bookmarks the top paragraph, an ID isn't saved for the link. So in that case I just want it to go to the where the content div starts. How is this possible?
Try this:
window.location.hash = "myDiv";
This will change the hash to myDiv (and scroll to the element whose id attribute is equal to the hash).
Example.

Categories

Resources