JKG Posted April 27, 2011 Share Posted April 27, 2011 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! Quote Link to comment https://forums.phpfreaks.com/topic/234848-javascript-keep-in-browser-window/ Share on other sites More sharing options...
micah1701 Posted April 27, 2011 Share Posted April 27, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/234848-javascript-keep-in-browser-window/#findComment-1206861 Share on other sites More sharing options...
JKG Posted April 27, 2011 Author Share Posted April 27, 2011 thanks for the suggestion micah1701. unfortunately that breaks the js, nothing happens when the trigger is clicked. is there any way to action a scroll to bottom in jquery do you know? Quote Link to comment https://forums.phpfreaks.com/topic/234848-javascript-keep-in-browser-window/#findComment-1206865 Share on other sites More sharing options...
JKG Posted April 27, 2011 Author Share Posted April 27, 2011 this but jquery sliding: http://www.myhtmlworld.com/wp-content/sources/collapse/ Quote Link to comment https://forums.phpfreaks.com/topic/234848-javascript-keep-in-browser-window/#findComment-1206867 Share on other sites More sharing options...
JKG Posted April 27, 2011 Author Share Posted April 27, 2011 <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! Quote Link to comment https://forums.phpfreaks.com/topic/234848-javascript-keep-in-browser-window/#findComment-1206872 Share on other sites More sharing options...
JKG Posted April 27, 2011 Author Share Posted April 27, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/234848-javascript-keep-in-browser-window/#findComment-1206886 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.