Jump to content

Recommended Posts

Hi,

 

i am wanting to install a footer tab, which will include a contact form and contact details. it will expand/close onclick.

i have that mechanism.

 

Thing is, with it being on the footer, i click the trigger, in this case: 'contact us' and it opens the content, but out of the view of the window, is there any way to get around this? here is the link, to hopefully explain better than i just have the issue!

http://jkgo.co.uk/d

 

thanks for your help guys!

Link to comment
https://forums.phpfreaks.com/topic/234848-javascript-keep-in-browser-window/
Share on other sites

you could simply put the toggle_container <div> above the <h2> tag that triggers its display in your code.  That would keep in on the page but it still might not have the desired effect your going for as it would then push the <h2> content down.  Try it and see.  You may need to get into some css positioning.

		<script type="text/javascript">
	$(document).ready(function(){

		$(".toggle_container").hide();

		$("h2.trigger").click(function(){
		window.scrollBy(0, 150);
			$(this).toggleClass("active").next().slideToggle("slow");
		});
	});
	</script>

 

this jumps it to the bottom before closing it, but is there anything to scroll down the page with the sliding animation?

 

thanks! :)

Solved. Kind of.

basically, you cannot achieve this with a slideToggle, just toggle.

 

	<script type="text/javascript">

$(document).ready(function(){
   		$("#toggle-button").click(function () {
		$("#subfooter").toggle();
		window.scrollBy(0, 150);
		});



	});	
	</script>

 

link mentioned earlier is now deleted.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.