Jump to content

DarkxPunk

Members
  • Posts

    465
  • Joined

  • Last visited

Everything posted by DarkxPunk

  1. Figured it out, gotta use switch, if anyone can find a more compact and dynamic way of doing this let me know. function changePage(link){ var nav = link.innerHTML; switch(nav) { case 'HOME': location.href = 'index.php'; break; case 'ABOUT ORMT': location.href = 'about.php'; break; case 'OUR RMTs': location.href = 'rmts.php'; break; case 'GET INVOLVED': location.href = 'involved.php'; break; case 'CONTACT US': location.href = 'contact.php'; break; }} The reason I need it dynamic is I want it so when any anchor is pressed instead of executing the href it will just change the location.href. Maybe it will be easier replacing all hrefs with onclick location.href = page... Idk. Thoughts?
  2. One thing I have noticed is that since I started using HTML 5 I have not really noticed as many limitations with older browsers as I thought. Why? Well because for the most part, you wont really use many of the new features within HTML 5. With Windows 8 out and Microsoft pushing people to move to it, and with android and iOS using webkit and almost all the other browsers up to date, the average person not able to support HTML 5 are big business. So write all your websites in HTML 5, get used to it cause its here to stay and majority of people are ready. But if you find limitations, its easy to solve them (even within a HTML 5 framework). Hope this helps.
  3. Its always good to look for alternatives, so good on DDs1, but I would say stop developing for IE. Develop for Safari, FireFox, Opera or Chrome. Once it looks great on one of those browsers look back and fix the bugs with IE. Doing it the other way will kill your groove because the browsers I listed actually follow the rules. Just a idea.
  4. Thank you! That was exactly right. Now to expand a little... So now that I have this understood I want to pull the correct page based upon the button clicked. I have set up an array: var link[] = (Object) Array('Home' => 'index.php','About ORMT' => 'about.php','Our RMTs' => 'rmts.php','Get Involved' => 'involved.php','Contact Us' => 'contact.php',);// I bet this is all wrong >.< Now what needs to happen is onclick compare link to the innerHTML of the buttons and then output the correct page into location.href so location.href = link. Thanks for any help. I have been playing around and can't wrap the loops around my head...
  5. Hey everyone, So I am playing around with iOS web apps and I found out that you can hide the browser top bar and bottom bar by using a cool meta tag and then saving the page to the home screen. Now awesome right? Well if you change pages it opens up the browser (thats no fun). Is it possible using JavaScript for it to change the page without opening the link? Thanks for any pointers.Peace
  6. Actually I was too busy researching event listener I will defiantly give this a try, thanks.
  7. Thank you everyone. Will look over this all tonight.
  8. First I will preface with YES I have done my share of research, but its still blowing over my head. Now this is my goal: I want to create a function that is versatile in that I don't need multiple for each time I use it. AKA it needs to be dynamic. I have played with this in the past doing show/hide stuff, but I can't make it fit doing what I want here. So now I want a function that will take the value of a form input on focus, compare it to a var connected to a class or id then erase it, then if the focus is blurred and the inputs value is empty to fill in the text that was in the var associated to the class or id. Now I think this can be done using EventListeners, my concept is on focus (any focus) detect value, compare value in a var then clear the value. Then on blur if empty replace text with var. What I don't understand is how to get the EventListener to work, how does it detect events without being called? Do I have to loop or no? Its confusing. Thanks for any help. Let me try to explain better [Form Field - Value: Textallot - ID: textAllot] {focus} ID is textAllot, var associated with the ID textAllot has the value of 'Textallot' both the Form Value and Var Value are == so now we clear text. {blur} Form Value is empty, ID is textAllot, var associated with ID textAllot has the value of 'Textallot', replace Form Value with 'Textallot'. else if Form Value is not empty do nothing. Better?
  9. So! I think I am satisfied with my results so here is the code: HTML <div id="bgHeader"></div> <div id="header"> <?php echo $qsBtn; ?> <form id="qSearch" action="index.php" method="get"> <label>Find:</label> <input id="qsText" type="text" name="qsInput" value="a Therapist by Name, Skill, Location" title="Start typing than hit enter" onfocus="csText(this);rePos(this)" onblur="fsText(this)"> <input id="qsImage" type="image" name="qsSubmit" title="Find" alt="Find" src="images/btnSearch.gif"> </form> <?php echo $naviPhone ?> <ul id="nav"> <li class="<?php echo $nHome; ?> nav stretch"><a class="stretch" href="index.php">HOME</a></li> <li class="<?php echo $nAbout; ?> nav stretch"><a class="stretch" href="about.php">ABOUT ORMT</a></li> <li class="<?php echo $nRMTs; ?> nav stretch"><a class="stretch" href="rmts.php">OUR RMTs</a></li> <li class="<?php echo $nInvolved; ?> nav stretch"><a class="stretch" href="involved.php">GET INVOLVED</a></li> <li class="<?php echo $nContact; ?> nav stretch"><a class="stretch" href="contact.php">CONTACT US</a></li> </ul> </div> CSS /* Header */#header,#bgHeader {padding: 10px 0 0 0;position: fixed;top: 0;left: 0;right: 0;}#bgHeader {background: url(../images/bgNav.png) repeat-x;width: 100%;height: 60px;}#wrap,#header {width: 980px;} JS function rePos(sfield){var yPos = window.pageYOffset || document.documentElement.scollTop;setTimeout(function() {window.scrollTo(0, yPos);},0);} Thats the basics, its not complete obviously but you can get the hint. If you would like a little assistance/walkthrough let me know and I will make a sample for yall. Peace!
  10. My bending is in regards to the fact that some people don't want to search cause they (I hope) feel they have a community here that is willing the help, and I agree that people should try, and I have which is why then I come here because I rather get community help than search for endless hours on google. If people are not trying, and people are just leeching it's obvious, and I would have hoped it be obvious I am not one.Anyway thanks for all the help peoples.
  11. Best way is a little simple PHP. This was what introduced me to php, and if your going to get heavy into coding learn PHP and js, etc.Create a HTML file with your nav bar, and in place of your navbar in the pages put <?php include"nav.html";?> all your pages must now be labeled as .phpGood luck
  12. Very funny. I would like to mention the reason people come to forums is they have either already searched or they are looking for a answer without searching, just being condescending is not polite. Now I did end up finding it and I did end up solving it.function rePos(sfield){var yPos = window.pageYOffset || document.documentElement.scollTop;setTimeout(function() {window.scrollTo(0, yPos);},0);} You call it on focus. Winning! Now problems arise, in landscape mode the page scrolls up right after page load and it hides under the URL bar for a unnecessary amount of time. Now I found a way to counteract it last night, but forgot I will keep searching. If anyone has ideas let me know. Thanks everyone.
  13. Okay I am almost there, next problem now is, HOW TO SAVE THE X/Y position. Basically I got it to work so it scrolls to the top after the element is put into focus, but now I need to save the current X/Y position prior to focusing so it can realign to its original position. Thanks for the info!
  14. Thanks for that, my method also worked:if (wrap.offsetWidth == 320){window.scrollTo(0, 1);}
  15. I think I will try having it detect the wrap width rather than window. See how that goes.
  16. Well I am doing this for iOS devices. And when it's in portrait the window is 320 if its landscape it's 480, so idk why it's doing it.
  17. Here:window.onload = function start(){if (window.innerHeight == 320){window.scrollTo(0, 1);}} In the body it calls this function.
  18. So here is something simple I was playing with. if (window.innerWidth = 320){window.scrollTo(0, 1);} Now I have this set to load when the page loads. For some reason though even when the width is not equal to 320 it still scrolls the window. Why?
  19. I have been using a bunch of those from the net can't get it to work. I will keep playing, but if anyone can find one that works give me a shout
  20. No code. Exactly... One thing about Apple is they follow standards when it comes to web development, so I am assuming what is happening with the browser is as soon as a field is placed into focus it uses code to call up the keyboard than JS/jQuery to center the page in the available space. I have researched this a bit but everyone wants to use jQuery. What needs to happen is after x amount of seconds the page scrolls to x0 y0. So JS should be able to do this, but how to detect the action and execute the delay. Any help is appriciated. Thanks in advance!
  21. Hey everyone, So anyone who programs for iOS or has an iOS device will notice when a form field gets focused and the keyboard loads up it centers that field, sometimes causing unwanted visuals. How can we counteract that? There is one catch, no JQUERY!. I want to completely understand JS before I go to jQuery so please oblige. Thanks! **************Look at the bottom for the results**************
  22. Okay solved it and did some playing. For my understanding can you tell me why zeroing that stuff out is so important?Thanks for all the help guys.
  23. I have attempted that but it screws up the floating, my search field flys to the left.Any ideas?
  24. That is exactly what I want and I managed to do that, but then I ran into a big problem of my float right (used on the search field) not working. Thats my problem as the subject of this post says.
×
×
  • Create New...