JavaScript - Using Scrollby With Safari For Ipad
Ok, so I have multiple issues, but this is the one I have not been able to work around. I'm building a simple website for personal use, so I know it only has to work on Safari for the iPad, a simple catalog of song charts for use on stage in my piano bar. Everything works GREAT in Safari/Chrome for Windows 7, but doesn't seem to quite work on Safari for iPad.
The issue I'm having is I've set up a DIV with two image buttons on it to execute a ScrollBy command to scroll the page up or down depending on the button. Everything works great on Safari for Windows 7, as in I can keep scrolling down the page by pressing the scroll down button multiple times. On iPad, it only works once, and will not continue to scroll. I've also tried it in Atomic Lite for iPad, with the same effect. I've mocked up a simple page, to take all the other variables out. http://www.duelingpianopiano.com/jef...testscroll.htm Eventually, I will be installing it he http://www.duelingpianopiano.com/jef...testscroll.htm The code in the head tag is below: <code> <script language="JavaScript" type="text/javascript"> <!-- Copyright 2003, Sandeep Gangadharan --> <!-- For more free scripts go to http://sivamdesign.com/scripts/ --> <!-- var y1 = 510; // change the # on the left to adjuct the Y co-ordinate (document.getElementById) ? dom = true : dom = false; function hideIt() { if (dom) {document.getElementById("layer1").style.visibility='hidden';} } function showIt() { if (dom) {document.getElementById("layer1").style.visibility='visible';} } function placeIt() { if (dom && !document.all) {document.getElementById("layer1").style.top = window.pageYOffset + (window.innerHeight - (window.innerHeight-y1)) + "px";} if (document.all) {document.all["layer1"].style.top = document.documentElement.scrollTop + (document.documentElement.clientHeight - (document.documentElement.clientHeight-y1)) + "px";} window.setTimeout("placeIt()", 10); } // --> </script> <script language="JavaScript"> function scrollup(){ parent.scrollBy(0,-window.innerHeight-50); } function scrolldown(){ parent.scrollBy(0,window.innerHeight-50); } </script> </code> The code from the body tag: <code> <body topmargin="00" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFF00" bgcolor="#FFFFFF" "overflow: visible" onLoad="placeIt(); showIt()"> INSERT CONTENT HERE <div id="layer1" style="position:absolute; right:0; width:50px; height:150px; visibility:hidden"> <font face="verdana, arial, helvetica, sans-serif" size="2"> <div style="float:left; background-color: ; padding:0px; border:0px solid black"> <img src="upbutton.png" width=50 height=75 border="0" align="left" onClick="scrollup();"> <img src="downbutton.png" width=50 height=75 border="0" align="left" onClick="scrolldown();"> </div> </code> Like I said, it works just as needed in Safari/Chrome for Windows 7, but not on iPad. Doesn't seem to work in IE 8, but that doesn't bother me. I have not tested in FireFox. Your ideas are much appreciated. I'm not an Apple person, so maybe there is a well known issue with scrollBy and Safari for iPad, that I'm not aware of. If that is the case, if anyone has an idea for a direction for a workaround that would be great as well. Eventually, I would like to use the smooth scrolling scripts that I've seen out there, but that is way down the road. I'm more worried about the functionality as is. Similar TutorialsI'm working on this project: http://bit.ly/tkrFsP It already works more or less fine in: IE7, IE8, IE9, FF, Chrome, Safari and Opera. Problems start when we try that in iPhone or iPad. iPhone works almost fine (except lags and AJAX/jQuery problems) but in iPad it has broken left navigation, wrongly re-sized thumbnails and it displays in half of the viewport. Also, there are problems with smoothness of jQuery animations and with AJAX unlike in other browsers on other devices (like PC). Any ideas on how to fix that? I've flicked through this: 1. http://www.smashingmagazine.com/2010...tting-started/ 2. http://developer.apple.com/library/s...62/_index.html It seems like a good place to start but there's many information on iPad/iPhone development on apple.com and their solutions don't fix my problems. -------- Mo 1. Anyone could outline here some basic code principles for iPad/iPhone? 2. Why project sub-page displays 5 times as large as it should on iPhone? Adding this: <meta name="viewport" content="width=device-width" /> doesn't help much and it even makes website work worse. Adding this: <meta name="viewport" content="maximum-scale=1,user-scalable=yes,width=960" > seems like a better solution but it's not perfect either. 3. How iPad's fixed containers work? 4. Why there's horizontal scroll appearing even with overflow-x: hidden? Hello I'm having problems with a very simple bit of Javascript not working with the latest version of Safari for ipads and iphones. The script in question is used as a 'previous image ' and 'next image' navigation facility, basically closing one pop-up window and opening up another, when viewing a photo gallery. It has worked perfectly for a number of years on all browsers. It is only the latest version of Safari for ipads and iphones where there's a problem. On an iphone, the new window unfortunately opens up in a new tab and the existing window fails to close. Mobile Safari soon reaches the maximum of 8 permissible tabs as a user moves through the photos gallery. On an ipad2, no new window opens and the existing window fails to close. the website is www.gethigh.co.uk Code: } function picPopup4(page,width,height){ //alert(scroll); var a; a = width / 2; var b; b = height / 2; var LeftPosition = (screen.width/2) - a; var TopPosition = (screen.height/2) - b; window.open(page, "", "width="+width+",height="+height+",toolbar=no,header=no,location=no,resizable=yes,"+"left="+LeftPosition +",top="+TopPosition+",scrollbars=yes"); window.close(); } and this is an example of the code creating the navigation within each pop-up window Code: <tr> <td align="center"><a class="link8" href="javascript:picPopup4('legslip1.html','560','770');" target="_self"> previous image</a> <a class="link8" href="javascript:window.close()">close window</a> <a class="link8" href="javascript:picPopup4('breaking2.html','505','800');" target="_self">next image</a></td> </tr> I'll come clean and admit I'm not a programmer and have a very basic and ancient understanding of HTML coding. My website must be approaching double digit years old (which will be immediately apparent if you view its structure). I can usually resolve most things, and maintain its functioanality when needs be, but this particular problem has got me stumped. I've come onto this forum to see if anyone could provide a simple work-around ? Or if anyone would know if this is a bug within Safari which may be rectified soon (a search through the Apple forums gave no clues). I'm loathed to make any major updates/changes to my site, as despite its age it renders beautifully on all browsers except the latest ipad/iphone Safari. Cheers and hopefully thanks in advance Garry .... The web page belows works OK in IE and FireFox on XP and Windows7 It does NOT work on IPAD using Safari. Question: How can I delete the new window("IPADREPORT") when I run it the second, third,fourth, etc time ? How can I get the window name( "IPADREPORT") to see if it exists? SUggestions? TIA, Steve42 <code> [aSafari.html] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <script language="JavaScript" type="text/javascript"> function pReport(){ // 1-17-12 var menuWindow = open("","ipadreport"); // 1-17-12 menuWindow.close(); // above closes previous report window var menuWindow = window.open('','ipadreport');// 1-17-12 document.ipadreport.submit(); menuWindow.focus(); } </script> <title>Ipad_PopUp_Test</title> </head> <body> <br><br> <form method=post name="ireport" target="ipadreport" action="http://myreport.asp"> <input type="hidden" name="reporttest" value="apple"> <a href='javascriptReport()'> Create Report</a> </form> </body> </html> </code> hi all, I want to be able to move an image from a left or right when tilting my ipad. when tilted the the right the image moves to the right according to the angel tilted and do the same to the other direction. the image is doubled (or more) the size of the stage (1024x768). I can't use Flash for obvious reasons so looking at other options. thanks Quick question, I found this code snip on stackoverflow and it has one little bug. When you touch / move in the element, the console.log is being fired. If you continue to drag / move outside the element, the console.logs still continue to fire. So it seems that once the event is started it's no longer confined to the element its being assigned to. Any ideas on how to keep it bound to the element? Here is the code: Code: $('#someElm').bind('touchmove',function(e){ e.preventDefault(); var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; console.log(touch.pageY+' '+touch.pageX); }); Thanks in advanced. Hi On the following URL on the iphone and Ipad the jqzoom script is showing the enlarged image on the left but works fine in IE, Chrome, Firefox etc. The script in use is jqzoom. http://tinyurl.com/bwcxf8c Any idea welcome. Thanks Roy Hi Guys, I've been searching the net for both examples and pluggins to create draggable divs and although I've found many, I cant find the effect I'm after. I want the div to slow down to a stop after it has been release like when you are scrolling on one of apples mobile devices. If anybody can point me in the right direction ill be very great full. In javascript normally when you call .focus() on a textbox id, it places the cursor inside the textbox. Trying the same on ipad does not place the cursor in the text field and the keypad does not pop up. How to place cursor and bring up the keypad on ipad using javascript? Any help is appreciated hi, When I navigate to a page with Ajax on my iphone or ipad, it doesn't show up, page is just blank, I have checked for errors and there is no errors?! here is my Ajax code Code: function datecheckFunction(){ var datecheckRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari datecheckRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ datecheckRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ datecheckRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server datecheckRequest.onreadystatechange = function(){ if(datecheckRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxDiv'); ajaxDisplay.innerHTML = datecheckRequest.responseText; } } var datepicker = document.getElementById('datepicker').value; var queryString = "?datepicker=" + datepicker; //Add the following line datecheckRequest.open("GET", "http://www.affordableappliancerepairs.co.uk/admin/checkdate.php" + queryString, true); datecheckRequest.send(null); } Hi there, I'm putting together a GeoCaching book for iPad that I intend to shop around upon completion. I have hit a stumbling block though. I want the co-ordinates in the PDF to open the Google Earth application. Using the current hyperlinks, the iPad links to Google Maps instead. Is it possible, using Javascript, to create a code that will directly open the Google Earth application and take the reader to those exact co-ordinates? Thanks in advance, WR I have a simple play js button on my HTML page as well as embedded music. So when you are a computer the music autoplays then stops and you have the option to listen to it again with the js button. This "theoretically" will work fine for the iPhone and iPad because even though the embedded music isn't auto playing the user can still click the listen button and hear the music. It works on the iPhone perfectly but not the iPad. I'm at a loss. Here is my jscript: function FFFFSound(soundobj) { var thissound= eval("document."+soundobj); thissound.Play(); } My embedded music: <embed src="music/FFFFKids.mp3" autostart="true" loop="false" hidden="true"> <embed src="music/FFFFKids.mp3" autostart="false" loop="false" hidden="true" name="sound1"> And my button: <input type="button" value="Listen" onClick="FFFFSound('sound1')" class="listen_button"> You can view the page at feefifofun.com I am at a total loss..... thanks! I am working on a website that features a custom javascript enabled audio player with an animated playhead to follow along with the provided spectrogram. An example of this is included below. http://cetus.ucsd.edu/voicesinthesea.../humpback.html I am having difficulty figuring out why the audio/spectrogram player does not work on an iPad. This component was built by a developer who I am not longer in contact with, thus I am in urgent need of some advice/wisdom. Thank you! Hi developers Needing some help. My javascript/css drop down menu is not working on the ipad or other touch screen devices. It works fine on laptops & desktops which use a mouse. I've discovered that this is because touchscreen devices like the Ipad do not recognise the onmouseover/onmouseout event handler that my script relies on. Is there any way I can modify my script so that it is compatiable both with traditional devices and touchscreen devices? The code I am using is: <script type="text/javascript"><!-- var timeout = 500; var closetimer = 0; var ddmenuitem = 0; // open hidden layer function mopen(id) { // cancel close timer mcancelclosetime(); // close old layer if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; // get new layer and show it ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } // close showed layer function mclose() { if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } // go close timer function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } // cancel close timer function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } // close layer when click-out document.onclick = mclose; //--></script> Which drives the following html: <ul id="links"> <li><a href="whats_new/whats_new.html">what's new</a></li> <li><a href="#" onmouseover="mopen('m1')" onmouseout="mclosetime()">clothing</a> <div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="clothing/clothing_page1.html">clothing</a> </div> </li> <li><a href="#" onmouseover="mopen('m2')" onmouseout="mclosetime()">accessories</a> <div id="m2" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="bags/bags_page1.html">bags</a> <a href="jewellery/jewellery_page1.html">jewellery</a> </div> </li> </ul> Any suggestions would be much appreciated. Thank you. Nonye I had a client specifically request that no matter the size of the browser he wants it to immediately enlarge to full screen onload of the flash site. I put this in the header: Code: <script type="text/javascript"> window.moveTo(0,0); if (document.all) {window.resizeTo(screen.availWidth,screen.availHeight)} else {window.outerHeight = screen.availHeight; window.outerWidth = screen.availWidth} </script> However, this specific code doesn't work in Safari on a mac. Is there any way I can make this compatible? My webpage won't load at all in Safari, unless I open it as a link from anbother site or if I manually type in the index.html after the url. when I take out the javascript though, it work perfectly. I always works in Firefox though. Any hints: <script type="text/javascript" src="stuff/x_core.js"></script><script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script><script src="stuff/ga.js" type="text/javascript"></script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-*******-*"); pageTracker._trackPageview(); } catch(err) {}</script> <script type="text/javascript"> var start_z_index = 3000; function bringtotop( item ) { item.style.zIndex = start_z_index++; } </script> <script type="text/javascript" src="stuff/x_event.js"></script> <script type="text/javascript" src="stuff/xenabledrag.js"></script> <script type="text/javascript" src="stuff/xenabledrag2.js"></script> Hi everyone, I have a javascript which used to delete object(s) when the "delete' button is clicked. The script is working fine on IE, but on Safari it do not wwork at all (when I click delete button the webpage stays the same). I think the reason is Safari is using a different javascript interpreter which cannot parse javascript developed in IE properly, such as "fireEvent". Please help me to fix the script for it to work on Safari. Here is the script: Code: function DeleteClick() { var frmSWO = document.getElementById("form"); var answer = confirm("Do you really want to delete?") if (answer != 0) { frmSWO.action = "/domsWeb/mtd/doms/web/operation/controller/manageWorkOrder/DeleteJobOrImage.do"; frmSWO.method = "post"; this.form.fireEvent('onsubmit'); frmSWO.submit(); } } I do appreciate any help. the page in question is http://martysimpson.com In firefox search the source code for Code: <script language="javascript" type="text/javascript"> <!-- function submitacajoommod1(formname) { var form = eval('document.'+formname);var place = form.email.value.indexOf("@",1);var point = form.email.value.indexOf(".",place+1); if (form.name.value == "" || form.name.value == "Name") { alert( "Please enter your name." );return false; } else if (form.email.value == "" || form.email.value == "E-mail") {alert( "Please enter a valid e-mail address." );return false; } else {if ((place > -1)&&(form.email.value.length >2)&&(point > 1)){form.submit();return true; } else {alert( "Please enter a valid e-mail address." );return false;}}} //--> </script><form action="http://martysimpson.com/component/acajoom/" method="post" name="modacajoomForm1"> I am on a mac using osx.4.11 firefox version 3.5 renders the above just fine. Safari version 3.04 just does not show the javascript at all which then makes the input fields on the sign-up for newsletter simply not show up. Any ideas? This seems to work ok to serve css to Opera: Code: if(history.navigationMode){ document.write('<link rel="stylesheet" type="text/css" href="opera.css">') } Is there a way to use Code: @media screen and (-webkit-min-device-pixel-ratio:0){} to serve css to Safari? ie, without having to use it on each tag in the main stylesheet? Tried Code: if(@media screen and (-webkit-min-device-pixel-ratio:0)){ document.write('<link rel="stylesheet" type="text/css" href="safari.css">') } but I think it's missing an 'is true' phrase... ? and this one Code: if('@media screen' && '(-webkit-min-device-pixel-ratio:0)'){ document.write('<link rel="stylesheet" type="text/css" href="safari.css">')} picks up Firefox and Opera as well. hi, on my website: http://zend.warrencreative.com/gemini-group/index.html the carousel on the right is not showing unless you hover your mouse over?! Can some one please help? I am using : http://www.twospy.com/galleriffic/ Hi all, The following script is scrolling my page smoothly, as it is supposed to, in IE and FF however it is not working at all in Safari, any version. The page is: www.christiantate.net When working correctly, you click the nav buttons in the left sidebar, the page scrolls to the appropriate section. The script: Code: $(function(){ $('a[href*=#]').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']'); if ($target.length) { var targetOffset = $target.offset().top-100; $('html,body').animate({scrollTop: targetOffset}, 1000); return false; } } }); }); Any help would be greatly appreciated. Thanks |