Search Results

Search found 133 results on 6 pages for 'scrolltop'.

Page 2/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • Detecting scroll in Jquery Mobile

    - by noway
    I can't detect whether the page is scrolled or not with jquery mobile. Scrolltop always return 0 in any case. <script> var interval = setInterval(function() { alert($("#articlecontent").scrollTop()); //alert($(window).scrollTop()); //alert($("#maindiv").scrollTop()); } }, 3000); </script> <div data-role="page" id="maindiv"> <div class="ui-bar ui-bar-b"> </div> <div id='articlecontent' data-role="content" data-iscroll> sldfjlkjsl lksjd kls df hjks djkh sdjfkh sjkf jksd jkhsdf jkhsd hjwiuhhfg skd jkshd fkj fkjsg kjhsdkjf sldfjlkjsl lksjd kls df hjks djkh sdjfkh sjkf jksd jkhsdf jkhsd hjwiuhhfg skd jkshd fkj fkjsg kjhsdkjf sldfjlkjsl lksjd kls df hjks djkh sdjfkh sjkf jksd jkhsdf jkhsd hjwiuhhfg skd jkshd fkj fkjsg kjhsdkjf </div> <div data-role="footer" data-id="foo1"> </div> </div>

    Read the article

  • css problem in top:??

    - by user175084
    i have to fix the header in a gridview and i use this in style Class <style type="text/css"> .gridFixedHeader { background-color:white; position:relative; top:expression(GridView1.offsetParent.scrollTop-2); } </style> but i get an error that expression(GridView1.offsetParent.scrollTop-2);is not valid... what all do i need to do to make this work..... any suggestions

    Read the article

  • http server implentation, the page does not show properly

    - by none
    well, as i am doing a small project of coding an http server. the code is at http://code.google.com/p/reactor/ the current puzzle is when asked to parse a page with java script and css. As an http server it just sends a page (copied from another website) and it parsed inproperly. when a simple html page is been parse , by my firefox, it shows ok, however when parsing a more complex page(css+javascript) the page is all wired like this : ???? ????? if(getCookie('pais999')==null){varisToplayerDouble="True";isToplayerDouble=(isToplayerDouble=="True")?true:falsevarToplayerCookieName='pais999';varTopLayerCookieExpiredDays=1;varToplayerLink='http://xads.zedo.com/ads2/c?a=239671;g=0;c=455000000;i=0;x=7168;n=455;s=0;k=http://www.pais.co.il/Pais/Games/Lotto/';varToplayerImpression='http://l4.zedo.com/log/p.gif?a=239671;c=455000000;x=7168;n=455;e=i;i=0;s=0;z='+Math.random();varToplayerBigPath='pais/January2007/98one_toplayer.swf';varToplayerSmallPath='pais/January2007/98one_reminder.swf';varToplayerBigWidth=1005;varToplayerBigHeight=500;varToplayerSmallWidth=100;varToplayerSmallHeight=100;varToplayerBigLeft=(0==0)?resWidth/2-ToplayerBigWidth/2:resWidth/2-ToplayerBigWidth/2+0varToplayerBigTop=0;varToplayerSmallLeft=resWidth-ToplayerSmallWidth-0;varToplayerSmallTop=0;varSecondsToChangeBigToSmall=15;}elseif(getCookie('NF999')==null){varisToplayerDouble="True";isToplayerDouble=(isToplayerDouble=="True")?true:falsevarToplayerCookieName='NF999';varTopLayerCookieExpiredDays=1;varToplayerLink='http://xads.zedo.com/ads2/c?a=238663;g=0;c=455000000;i=0;x=7168;n=455;s=0;k=http://www.new-pharm.co.il/SkiGame/?ToolID=OLJD8O';varToplayerImpression='http://l4.zedo.com/log/p.gif?a=238663;c=455000000;x=7168;n=455;e=i;i=0;s=0;z='+Math.random();varToplayerBigPath='NewFarm/Ski/995ONE_TopLayer_550x360.swf';varToplayerSmallPath='NewFarm/Ski/995ONE_Reminder_100x100.swf';varToplayerBigWidth=550;varToplayerBigHeight=360;varToplayerSmallWidth=100;varToplayerSmallHeight=100;varToplayerBigLeft=(0==0)?resWidth/2-ToplayerBigWidth/2:resWidth/2-ToplayerBigWidth/2+0varToplayerBigTop=0;varToplayerSmallLeft=resWidth-ToplayerSmallWidth-0;varToplayerSmallTop=0;varSecondsToChangeBigToSmall=15;}elseif(1==0){}$("divToplayerBig").style.width=ToplayerBigWidth;$("divToplayerBig").style.height=ToplayerBigHeight;$("divToplayerBig").style.left=resWidth/2-ToplayerBigWidth/2;$("divToplayerSmall").style.width=ToplayerSmallWidth;$("divToplayerSmall").style.height=ToplayerSmallHeight;$("divToplayerSmall").style.right=ToplayerSmallWidthvartopOff=0;if(ToplayerBigTop0)topOff=resHeight-ToplayerBigHeight+ToplayerBigTop;varisMain=false;#divToplayerBig{position:absolute;right:20px;bottom:1px;}bodydiv#divToplayerBig{position:fixed;}#divToplayerSmall{position:absolute;right:20px;bottom:10px;}bodydiv#divToplayerSmall{position:fixed;}????|??????LIVE|???????????|ONE???????|ONETV |????'??|BigONE|?????????| CrazyONE | where the source code of the html is : ONE:???:??????????????????????????? ????  ????? if(getCookie('pais999')==null){varisToplayerDouble="True";isToplayerDouble=(isToplayerDouble=="True")?true:falsevarToplayerCookieName='pais999';varTopLayerCookieExpiredDays=1;varToplayerLink='http://xads.zedo.com/ads2/c?a=239671;g=0;c=455000000;i=0;x=7168;n=455;s=0;k=http://www.pais.co.il/Pais/Games/Lotto/';varToplayerImpression='http://l4.zedo.com/log/p.gif?a=239671;c=455000000;x=7168;n=455;e=i;i=0;s=0;z='+Math.random();varToplayerBigPath='pais/January2007/98one_toplayer.swf';varToplayerSmallPath='pais/January2007/98one_reminder.swf';varToplayerBigWidth=1005;varToplayerBigHeight=500;varToplayerSmallWidth=100;varToplayerSmallHeight=100;varToplayerBigLeft=(0==0)?resWidth/2-ToplayerBigWidth/2:resWidth/2-ToplayerBigWidth/2+0varToplayerBigTop=0;varToplayerSmallLeft=resWidth-ToplayerSmallWidth-0;varToplayerSmallTop=0;varSecondsToChangeBigToSmall=15;}elseif(getCookie('NF999')==null){varisToplayerDouble="True";isToplayerDouble=(isToplayerDouble=="True")?true:falsevarToplayerCookieName='NF999';varTopLayerCookieExpiredDays=1;varToplayerLink='http://xads.zedo.com/ads2/c?a=238663;g=0;c=455000000;i=0;x=7168;n=455;s=0;k=http://www.new-pharm.co.il/SkiGame/?ToolID=OLJD8O';varToplayerImpression='http://l4.zedo.com/log/p.gif?a=238663;c=455000000;x=7168;n=455;e=i;i=0;s=0;z='+Math.random();varToplayerBigPath='NewFarm/Ski/995ONE_TopLayer_550x360.swf';varToplayerSmallPath='NewFarm/Ski/995ONE_Reminder_100x100.swf';varToplayerBigWidth=550;varToplayerBigHeight=360;varToplayerSmallWidth=100;varToplayerSmallHeight=100;varToplayerBigLeft=(0==0)?resWidth/2-ToplayerBigWidth/2:resWidth/2-ToplayerBigWidth/2+0varToplayerBigTop=0;varToplayerSmallLeft=resWidth-ToplayerSmallWidth-0;varToplayerSmallTop=0;varSecondsToChangeBigToSmall=15;}elseif(1==0){}$("divToplayerBig").style.width=ToplayerBigWidth;$("divToplayerBig").style.height=ToplayerBigHeight;$("divToplayerBig").style.left=resWidth/2-ToplayerBigWidth/2;$("divToplayerSmall").style.width=ToplayerSmallWidth;$("divToplayerSmall").style.height=ToplayerSmallHeight;$("divToplayerSmall").style.right=ToplayerSmallWidthvartopOff=0;if(ToplayerBigTop0)topOff=resHeight-ToplayerBigHeight+ToplayerBigTop;varisMain=false;#divToplayerBig{position:absolute;right:20px;bottom:1px;}bodydiv#divToplayerBig{position:fixed;}div#divToplayerBig{right:auto;bottom:auto;left:expression((-20-divToplayerBig.offsetWidth+(document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth)+(ignoreMe2=document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft))+'px');top:expression((0-divToplayerBig.offsetHeight-topOff+(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight)+(ignoreMe=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop))+'px');}#divToplayerSmall{position:absolute;right:20px;bottom:10px;}bodydiv#divToplayerSmall{position:fixed;}div#divToplayerSmall{right:auto;bottom:auto;left:expression((-20-divToplayerSmall.offsetWidth+(document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth)+(ignoreMe2=document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft))+'px');top:expression((0-divToplayerSmall.offsetHeight+(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight)+(ignoreMe=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop))+'px');}varisTopTrans=(ToplayerBigPath.indexOf("transparent")-1)?false:true;varisRemTrans=(ToplayerSmallPath.indexOf("transparent")-1)?false:true;vartop1session=3;vartop2session=5;InitToplayer(isTopTrans,isRemTrans);window.onload=StartToplayer;????|??????LIVE|???????????|ONE???????|ONETV |????'??|BigONE|?????????|  CrazyONE |????????????????????????????????????????????????????????19/01/07  19:30?????????????????????-?????:?????????????????????????19/01/07  18:43??????????????:??????????????????????19/01/07  17:41???:??????????????????????????????????19/01/07  16:49?????:??????"?????????????/?????1:2,??????"??????19/01/07  16:45????????????????????????????,?????2.5???????????????19/01/07  16:37???????:???"?????????????????-19:30?????????????19/01/07  14:32?????"?????????-18:30?????????"????????,????'??????19/01/07  14:45????????????????????????????????"?:??????????????19/01/07  14:37??????????:??????????????????????????????0:019/01/07  13:46varswfPeleSmall=newSWFObject("http://images.one.co.il/images/PeleEmulator/emulator_pelephone_01a.swf","peleSmall",160,470,"6","#FFFFFF");swfPeleSmall.addParam("quality","high");swfPeleSmall.addParam("wmode","transparent");swfPeleSmall.write("divPeleSmall");varswfPeleBig=newSWFObject("http://images.one.co.il/images/PeleEmulator/emulator_pelephone_02d.swf","peleBig",400,470,"6","#FFFFFF");swfPeleBig.addParam("quality","high");swfPeleBig.addParam("wmode","transparent");swfPeleBig.write("divWithBig");???:???????????????????????????????????????-ONE????????????????????????????????????????????.????????,???????????1:2,?????????????:"???????????"DisplayFlash("W_S_round_border_pic.swf","156","201","1","style=position:absolute");?????????????????????????(??????)?????????                          19/01/20077:26???????????????(????)????????????????????????????6:3,5:7?-5:7???????????????????????,???????23?????.?????,????????????????????????????????,???????????????????????????????????????????,????????????????????.??????????????????????????,??????????????????????????.????????????????????????????-1:1?????????.?????????????????????????????'?????????????????????????????.?????????????.???????????????????????????????(16???????),???????????????????????????????????????3???????,???????????????????????.????????- (only part of of the page presentation in firefox and page source html) why is it happening? what is midding in the http response? StringBuffer tResponse = new StringBuffer(); tResponse.append("HTTP/1.1 200 OK\n"); tResponse.append("Date: "+new Date().toString() +'\n'); tResponse.append("server: http-reactor/0.1-dev\n"); tResponse.append("last-Modified:"+ d.toString() +'\n'); tResponse.append("Content-Type: text/html; charset=windows-1255\n"); tResponse.append("Accept-Language: he; q=1.0, en; q=0.5:); tResponse.append("Content-Length: "+tFileContent.length()+'\n'); tResponse.append('\n'); tResponse.append(tFileContent); public StringBuffer FetchData(String FileName) throws FileNotFoundException{ StringBuffer tFileContent = new StringBuffer(); if (FileName.contains("../")) throw new SecurityException(); if (FileName.equals("/")) FileName = "\\index.html"; FileName.replace('/', '\\'); File f = new File(_root + FileName); Scanner scanner = new Scanner(f); while(scanner.hasNext()) tFileContent.append(scanner.next()); return generateResponse(tFileContent,f.lastModified()); } private StringBuffer generateResponse(StringBuffer tFileContent, long l) { StringBuffer tResponse = new StringBuffer(); Date d = new Date(l); tResponse.append("HTTP/1.1 200 OK\n"); tResponse.append("Date: "+new Date().toString() +'\n'); tResponse.append("server: http-reactor/0.1-dev\n"); tResponse.append("last-Modified:"+ d.toString() +'\n'); tResponse.append("Content-Type: text/html; charset=windows-1255\n"); tResponse.append("Accept-Language: he; q=1.0, en; q=0.5:); tResponse.append("Content-Length: "+tFileContent.length()+'\n'); tResponse.append('\n'); tResponse.append(tFileContent); return tResponse; }

    Read the article

  • jQuery scroll fails for iframe (firefox)

    - by knappy
    I cannot get scroll to work, here is the complete stuff: http://zed.mit.edu/scroll2/buc.php I'm trying to refresh the page while maintaining the scroll position of the iframe inside. I'd like to have an alert when I actively scroll the iframe, these two both fail: $(top).frames['#iframe_bucinid'].scroll(function() .... $('#iframe_bucinid').scroll(function() ... The page's iframe is defined as: <iframe class="inframe" src="bucin.php" name="bucin" id="iframe_bucinid"> Notice that getting the scrollTop works with top.frames['bucin'].document.body.scrollTop

    Read the article

  • Envoking mouse capturing function onmousedown?

    - by Babiker
    I have the following: <html> <script type="text/javascript"> document.onmousemove = getCursorXY; function getCursorXY(e) { document.getElementById('cursorX').value = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); document.getElementById('cursorY').value = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); } </script> <body> <input id="cursorX" size="3"> <input id="cursorY" size="3"> <input type="button" id="button"> </body> </html> With this my mouse coordinates are displayed in the input fields when the page loads and whenever i move the mouse. How can i make this work only when i mousedown over #button and then stop at the last coordinates when i mouseup only over #button? using firefox 3.6.3 Thanks in advance :)

    Read the article

  • Image jQuery scroller in a container. (like facebook cropper) can't get values of position.

    - by Stefan
    Hey all. Having a reallllll mind pain. I have a php image uploader which is all good and sotring the file and the jquery ajax is returning the image in an ammended html div with a div set up like this: #crop-holder { width:80px; height:80px; margin:10px 10px 20px 10px; border:1px #c0c0c0 solid; overflow:hidden; cursor:move; } The image is viewing fine and I am using the jquery scrollview plugin: http://code.google.com/p/jquery-scrollview/ I have tried adding a few lines to the plugin to store variables of scrollTop and Left and then replacing two hidden input values with x and y in my page. And then on the returned ajax html in the div I am trying to on a button click (for example) retrieve the values of the two hidden inputs.... Heres what i added to the plugin (i'm no js expert!): .mouseout(function(){ var _m = this.m; var lasty = _m.scrollTop(); getElementById("ycord").value = lasty; var lastx = _m.scrollLeft(); getElementById("xcord").value = lastx; self.stopgrab(); }) Still no luck!! How can I get the scrollTop and scrollLeft and successfully prepare them for sending onto another php script!? Thanks:) stefpretty

    Read the article

  • Javascript onscroll and mouse position

    - by EddyR
    I have a script that runs a addEventListener for onmousemove and onscroll on the document body to get the cursor position. A onmousemove event works fine (client + scroll), however when a onscroll event occurs clientX/Y seems to inherit scrollTop/Left values instead (only scroll). Is there a way around this? clickDocument = (document.documentElement != undefined && document.documentElement.clientHeight != 0) ? document.documentElement : document.body; var posx = 0; var posy = 0; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX; posy = e.clientY; } var scrollx = window.pageXOffset == undefined ? clickDocument.scrollLeft : window.pageXOffset; var scrolly = window.pageYOffset == undefined ? clickDocument.scrollTop : window.pageYOffset;

    Read the article

  • Getting javascript mouse position relative to website prefferably without jQuery

    - by Constructor
    I've found this snippet on Ajaxian, but I can't seem to use the cursor.y (or cursor.x) as a variable and when the function is called as such it does not seem to work. Is there a syntax problem or something else? function getPosition(e) { e = e || window.event; var cursor = {x:0, y:0}; if (e.pageX || e.pageY) { cursor.x = e.pageX; cursor.y = e.pageY; } else { cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft; cursor.y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop; } return cursor; } I'd preffer not to use jQuery UI if possible, since I've always thaught of jQuery and librarys as a bit of an overkill for most JS programing.

    Read the article

  • Unexpected token }

    - by tann98
    i have a script, to open a model window, but it wont work. google chrome give me "Uncaught SyntaxError: Unexpected token }", but on a line that doesnt even have a closing curly brace. here is my script: function showm(id1){ window.onscroll=function(){document.getElementById(id1).style.top=document.body.scrollTop;}; document.getElementById(id1).style.display="block"; document.getElementById(id1).style.top=document.body.scrollTop; } does anybody have any ideas on this? any help is appreciated.

    Read the article

  • Using JS script for "raining images". Can't seem to hide pre-loaded image

    - by user1813605
    I am trying to hide an image in a script pre-loading on the page. Below script makes images "rain" down the screen onClick. It functions well, but it displays the pre-loaded image itself on the page before the button is clicked. I'm trying to hide the image until the button is pressed. If anyone has any insight on how to hide the image until the function dispenseMittens() runs, I'd be eternally grateful :) Thanks! <script language="javascript"> var pictureSrc = 'mitten.gif'; //the location of the mittens var pictureWidth = 40; //the width of the mittens var pictureHeight = 46; //the height of the mittens var numFlakes = 10; //the number of mittens var downSpeed = 0.01; var lrFlakes = 10; var EmergencyMittens = false; //safety checks. Browsers will hang if this is wrong. If other values are wrong there will just be errors if( typeof( numFlakes ) != 'number' || Math.round( numFlakes ) != numFlakes || numFlakes < 1 ) { numFlakes = 10; } //draw the snowflakes for( var x = 0; x < numFlakes; x++ ) { if( document.layers ) { //releave NS4 bug document.write('<layer id="snFlkDiv'+x+'"><img src="'+pictureSrc+'" height="'+pictureHeight+'" width="'+pictureWidth+'" alt="*" border="0"></layer>'); } else { document.write('<div style="position:absolute;" id="snFlkDiv'+x+'"><img src="'+pictureSrc+'" height="'+pictureHeight+'" width="'+pictureWidth+'" alt="*" border="0"></div>'); } } //calculate initial positions (in portions of browser window size) var xcoords = new Array(), ycoords = new Array(), snFlkTemp; for( var x = 0; x < numFlakes; x++ ) { xcoords[x] = ( x + 1 ) / ( numFlakes + 1 ); do { snFlkTemp = Math.round( ( numFlakes - 1 ) * Math.random() ); } while( typeof( ycoords[snFlkTemp] ) == 'number' ); ycoords[snFlkTemp] = x / numFlakes; } //now animate function mittensFall() { if( !getRefToDivNest('snFlkDiv0') ) { return; } var scrWidth = 0, scrHeight = 0, scrollHeight = 0, scrollWidth = 0; //find screen settings for all variations. doing this every time allows for resizing and scrolling if( typeof( window.innerWidth ) == 'number' ) { scrWidth = window.innerWidth; scrHeight = window.innerHeight; } else { if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { scrWidth = document.documentElement.clientWidth; scrHeight = document.documentElement.clientHeight; } else { if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { scrWidth = document.body.clientWidth; scrHeight = document.body.clientHeight; } } } if( typeof( window.pageYOffset ) == 'number' ) { scrollHeight = pageYOffset; scrollWidth = pageXOffset; } else { if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { scrollHeight = document.body.scrollTop; scrollWidth = document.body.scrollLeft; } else { if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { scrollHeight = document.documentElement.scrollTop; scrollWidth = document.documentElement.scrollLeft; } } } //move the snowflakes to their new position for( var x = 0; x < numFlakes; x++ ) { if( ycoords[x] * scrHeight > scrHeight - pictureHeight ) { ycoords[x] = 0; } var divRef = getRefToDivNest('snFlkDiv'+x); if( !divRef ) { return; } if( divRef.style ) { divRef = divRef.style; } var oPix = document.childNodes ? 'px' : 0; divRef.top = ( Math.round( ycoords[x] * scrHeight ) + scrollHeight ) + oPix; divRef.left = ( Math.round( ( ( xcoords[x] * scrWidth ) - ( pictureWidth / 2 ) ) + ( ( scrWidth / ( ( numFlakes + 1 ) * 4 ) ) * ( Math.sin( lrFlakes * ycoords[x] ) - Math.sin( 3 * lrFlakes * ycoords[x] ) ) ) ) + scrollWidth ) + oPix; ycoords[x] += downSpeed; } } //DHTML handlers function getRefToDivNest(divName) { if( document.layers ) { return document.layers[divName]; } //NS4 if( document[divName] ) { return document[divName]; } //NS4 also if( document.getElementById ) { return document.getElementById(divName); } //DOM (IE5+, NS6+, Mozilla0.9+, Opera) if( document.all ) { return document.all[divName]; } //Proprietary DOM - IE4 return false; } function dispenseMittens() { if (EmergencyMittens) { window.clearInterval(EmergencyMittens); } else { EmergencyMittens = window.setInterval('mittensFall();',100); } } </script>

    Read the article

  • Change Modul popup every 30 sec Javascript

    - by SoftwareDeveloper
    I have a div id called modalpage and have css. I need a javascript function which can dynamically shows popup for 20 mins and change in every 30 secs right now i have the following javascript function. Can anybody help me please <script language="javascript" type="text/javascript"> function revealModal(divID) { window.onscroll = function () { document.getElementById(divID).style.top = document.body.scrollTop; }; document.getElementById(divID).style.display = "block"; document.getElementById(divID).style.top = document.body.scrollTop; } which is called by a input id button. <input id="Button1" type="button" value="Click here" onclick="revealModal('modalPage')" /> Thanks

    Read the article

  • Scrolling an HTML 5 page using JQuery

    - by nikolaosk
    In this post I will show you how to use JQuery to scroll through an HTML 5 page.I had to help a friend of mine to implement this functionality and I thought it would be a good idea to write a post.I will not use any JQuery scrollbar plugin,I will just use the very popular JQuery Library. Please download the library (minified version) from http://jquery.com/download.Please find here all my posts regarding JQuery.Also have a look at my posts regarding HTML 5.In order to be absolutely clear this is not (and could not be) a detailed tutorial on HTML 5. There are other great resources for that.Navigate to the excellent interactive tutorials of W3School.Another excellent resource is HTML 5 Doctor.Two very nice sites that show you what features and specifications are implemented by various browsers and their versions are http://caniuse.com/ and http://html5test.com/. At this times Chrome seems to support most of HTML 5 specifications.Another excellent way to find out if the browser supports HTML 5 and CSS 3 features is to use the Javascript lightweight library Modernizr.In this hands-on example I will be using Expression Web 4.0.This application is not a free application. You can use any HTML editor you like.You can use Visual Studio 2012 Express edition. You can download it here. Let me move on to the actual example.This is the sample HTML 5 page<!DOCTYPE html><html lang="en">  <head>    <title>Liverpool Legends</title>        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >        <link rel="stylesheet" type="text/css" href="style.css">        <script type="text/javascript" src="jquery-1.8.2.min.js"> </script>     <script type="text/javascript" src="scroll.js">     </script>       </head>  <body>    <header>        <h1>Liverpool Legends</h1>    </header>        <div id="main">        <table>        <caption>Liverpool Players</caption>        <thead>            <tr>                <th>Name</th>                <th>Photo</th>                <th>Position</th>                <th>Age</th>                <th>Scroll</th>            </tr>        </thead>        <tfoot class="footnote">            <tr>                <td colspan="4">We will add more photos soon</td>            </tr>        </tfoot>    <tbody>        <tr class="maintop">        <td>Alan Hansen</td>            <td>            <figure>            <img src="images\Alan-hansen-large.jpg" alt="Alan Hansen">            <figcaption>The best Liverpool Defender <a href="http://en.wikipedia.org/wiki/Alan_Hansen">Alan Hansen</a></figcaption>            </figure>            </td>            <td>Defender</td>            <td>57</td>            <td class="top">Middle</td>        </tr>        <tr>        <td>Graeme Souness</td>            <td>            <figure>            <img src="images\graeme-souness-large.jpg" alt="Graeme Souness">            <figcaption>Souness was the captain of the successful Liverpool team of the early 1980s <a href="http://en.wikipedia.org/wiki/Graeme_Souness">Graeme Souness</a></figcaption>            </figure>            </td>            <td>MidFielder</td>            <td>59</td>        </tr>        <tr>        <td>Ian Rush</td>            <td>            <figure>            <img src="images\ian-rush-large.jpg" alt="Ian Rush">            <figcaption>The deadliest Liverpool Striker <a href="http://it.wikipedia.org/wiki/Ian_Rush">Ian Rush</a></figcaption>            </figure>            </td>            <td>Striker</td>            <td>51</td>        </tr>        <tr class="mainmiddle">        <td>John Barnes</td>            <td>            <figure>            <img src="images\john-barnes-large.jpg" alt="John Barnes">            <figcaption>The best Liverpool Defender <a href="http://en.wikipedia.org/wiki/John_Barnes_(footballer)">John Barnes</a></figcaption>            </figure>            </td>            <td>MidFielder</td>            <td>49</td>            <td class="middle">Bottom</td>        </tr>                <tr>        <td>Kenny Dalglish</td>            <td>            <figure>            <img src="images\kenny-dalglish-large.jpg" alt="Kenny Dalglish">            <figcaption>King Kenny <a href="http://en.wikipedia.org/wiki/Kenny_Dalglish">Kenny Dalglish</a></figcaption>            </figure>            </td>            <td>Midfielder</td>            <td>61</td>        </tr>        <tr>            <td>Michael Owen</td>            <td>            <figure>            <img src="images\michael-owen-large.jpg" alt="Michael Owen">            <figcaption>Michael was Liverpool's top goal scorer from 1997–2004 <a href="http://www.michaelowen.com/">Michael Owen</a></figcaption>            </figure>            </td>            <td>Striker</td>            <td>33</td>        </tr>        <tr>            <td>Robbie Fowler</td>            <td>            <figure>            <img src="images\robbie-fowler-large.jpg" alt="Robbie Fowler">            <figcaption>Fowler scored 183 goals in total for Liverpool <a href="http://en.wikipedia.org/wiki/Robbie_Fowler">Robbie Fowler</a></figcaption>            </figure>            </td>            <td>Striker</td>            <td>38</td>        </tr>        <tr class="mainbottom">            <td>Steven Gerrard</td>            <td>            <figure>            <img src="images\steven-gerrard-large.jpg" alt="Steven Gerrard">            <figcaption>Liverpool's captain <a href="http://en.wikipedia.org/wiki/Steven_Gerrard">Steven Gerrard</a></figcaption>            </figure>            </td>            <td>Midfielder</td>            <td>32</td>            <td class="bottom">Top</td>        </tr>    </tbody></table>          </div>            <footer>        <p>All Rights Reserved</p>      </footer>     </body>  </html>  The markup is very easy to follow and understand. You do not have to type all the code,simply copy and paste it.For those that you are not familiar with HTML 5, please take a closer look at the new tags/elements introduced with HTML 5.When I view the HTML 5 page with Firefox I see the following result. I have also an external stylesheet (style.css). body{background-color:#efefef;}h1{font-size:2.3em;}table { border-collapse: collapse;font-family: Futura, Arial, sans-serif; }caption { font-size: 1.2em; margin: 1em auto; }th, td {padding: .65em; }th, thead { background: #000; color: #fff; border: 1px solid #000; }tr:nth-child(odd) { background: #ccc; }tr:nth-child(even) { background: #404040; }td { border-right: 1px solid #777; }table { border: 1px solid #777;  }.top, .middle, .bottom {    cursor: pointer;    font-size: 22px;    font-weight: bold;    text-align: center;}.footnote{text-align:center;font-family:Tahoma;color:#EB7515;}a{color:#22577a;text-decoration:none;}     a:hover {color:#125949; text-decoration:none;}  footer{background-color:#505050;width:1150px;}These are just simple CSS Rules that style the various HTML 5 tags,classes. The jQuery code that makes it all possible resides inside the scroll.js file.Make sure you type everything correctly.$(document).ready(function() {                 $('.top').click(function(){                     $('html, body').animate({                         scrollTop: $(".mainmiddle").offset().top                     },4000 );                  });                 $('.middle').click(function(){                     $('html, body').animate({                         scrollTop: $(".mainbottom").offset().top                     },4000);                  });                     $('.bottom').click(function(){                     $('html, body').animate({                         scrollTop: $(".maintop").offset().top                     },4000);                  }); });  Let me explain what I am doing here.When I click on the Middle word (  $('.top').click(function(){ ) this relates to the top class that is clicked.Then we declare the elements that we want to participate in the scrolling. In this case is html,body ( $('html, body').animate).These elements will be part of the vertical scrolling.In the next line of code we simply move (navigate) to the element (class mainmiddle that is attached to a tr element.)      scrollTop: $(".mainmiddle").offset().top  Make sure you type all the code correctly and try it for yourself. I have tested this solution will all 4-5 major browsers.Hope it helps!!!

    Read the article

  • Can you Download the cmid.ctt File

    - by ArtistDigital
    Can you Download the cmid.ctt File Zong.com.pk http://203.82.55.30/websms/default.aspx?txt_Msg=your-name&txt_MNumber=033489667417&txt_Nick=your-name Still Waiting for Reply.... kindly more Developer to broke the Server expection function alphanumeric(alphane) { var numaric = alphane; for(var j=0; j 47 && hh<59) || (hh 64 && hh<91) || (hh 96 && hh<123)) { } else { return false; } } return true; } function charscount(msg, frm) { frm.num_chars.value = 147 - msg.length; // m = msg; } function moveDivDown() { var el = document.getElementById("chatwindow") st = el.scrollTop; el.scrollTop = el.scrollTop + 300 } function trim(str) { return str.replace(/^\s*|\s*$/g,""); } var XMLHttp; var XMLHttp2; /SEND TO SERVER/ function GetXmlHttpObject() { var objXMLHttp=null /* if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest() } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") }*/ var ua = navigator.userAgent.toLowerCase(); if (!window.ActiveXObject) objXMLHttp = new XMLHttpRequest(); else if (ua.indexOf('msie 5') == -1) objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP"); else objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP"); return objXMLHttp } function updateChatWindow() { var txt_Msg, txt_mNumber, txt_Nick, myMessage txt_MNumber = document.getElementById("txt_MNumber").value txt_Msg = document.getElementById("txt_Msg").value txt_Nick = document.getElementById("txt_Nick").value txt_Nick = trim (txt_Nick) if (txt_Nick.length==0) { alert ("Please enter the Nick Name") document.getElementById("txt_Nick").focus() document.getElementById("txt_Nick").value="" return false; } if (!alphanumeric(txt_Nick)) { alert ("Please enter a valid alphanumeric Nick Name") document.getElementById("txt_Nick").value="" document.getElementById("txt_Nick").focus() return false; } if (txt_Msg.length==0) return false; if (txt_MNumber.length != 10) { alert ("Please Enter a 10 digit recipient mobile number") return false } if (!IsNumeric (txt_MNumber)) { alert ("Please Enter a valid 10 digit recipient mobile number") return false } document.getElementById("txt_Msg").value = "" document.getElementById("num_chars").value = "147" document.getElementById("txt_Msg").focus() myMessage = '' +txt_Nick + ' Says: ' + txt_Msg + '' document.getElementById("chatwindow").innerHTML= document.getElementById("chatwindow").innerHTML + myMessage moveDivDown() XMLHttp = GetXmlHttpObject() if (XMLHttp==null) { alert ("Browser does not support HTTP Request") return false; } var url="default.aspx?" url=url+"txt_Msg="+txt_Msg url=url+"&txt_MNumber="+txt_MNumber url=url+"&txt_Nick="+txt_Nick url=url+"&sid="+Math.random() XMLHttp.onreadystatechange=stateChanged XMLHttp.open("GET",url,true) XMLHttp.send(null) return false; } function stateChanged() { if (XMLHttp.readyState==4 || XMLHttp.readyState=="complete") { try { document.getElementById("chatwindow").innerHTML= document.getElementById("chatwindow").innerHTML+ XMLHttp.responseText moveDivDown() } catch (e){} } } /RECEIVE FROM SERVER/ function checkResponse() { XMLHttp2 = GetXmlHttpObject() if (XMLHttp2==null) { alert ("Browser does not support HTTP Request") return } var url="" url=url+"?r=C" url=url+"&sid="+Math.random() XMLHttp2.onreadystatechange=stateChanged2 XMLHttp2.open("GET",url,true) XMLHttp2.send(null) } function stateChanged2() { if (XMLHttp2.readyState==4 || XMLHttp2.readyState=="complete") { try { document.getElementById("chatwindow").innerHTML= document.getElementById("chatwindow").innerHTML + XMLHttp2.responseText moveDivDown() } catch (e){} //Again Check Updates after 3 Seconds setTimeout("checkResponse()", 2000); } } function IsNumeric(sText) { var ValidChars = "0123456789"; var IsNumber=true; var Char; for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { IsNumber = false; } } return IsNumber; }

    Read the article

  • Problem with the output of Jquery function .offset in IE

    - by vandalk
    Hello! I'm new to jquery and javascript, and to web site developing overall, and I'm having a problem with the .offset function. I have the following code working fine on chrome and FF but not working on IE: $(document).keydown(function(k){ var keycode=k.which; var posk=$('html').offset(); var centeryk=screen.availHeight*0.4; var centerxk=screen.availWidth*0.4; $("span").text(k.which+","+posk.top+","+posk.left); if (keycode==37){ k.preventDefault(); $("html,body").stop().animate({scrollLeft:-1*posk.left-centerxk}) }; if (keycode==38){ k.preventDefault(); $("html,body").stop().animate({scrollTop:-1*posk.top-centeryk}) }; if (keycode==39){ k.preventDefault(); $("html,body").stop().animate({scrollLeft:-1*posk.left+centerxk}) }; if (keycode==40){ k.preventDefault(); $("html,body").stop().animate({scrollTop:-1*posk.top+centeryk}) }; }); hat I want it to do is to scroll the window a set percentage using the arrow keys, so my thought was to find the current coordinates of the top left corner of the document and add a percentage relative to the user screen to it and animate the scroll so that the content don't jump and the user looses focus from where he was. The $("span").text are just so I know what's happening and will be turned into comments when the code is complete. So here is what happens, on Chrome and Firefox the output of the $("span").text for the position variables is correct, starting at 0,0 and always showing how much of the content was scrolled in coordinates, but on IE it starts on -2,-2 and never gets out of it, even if I manually scroll the window until the end of it and try using the right arrow key it will still return the initial value of -2,-2 and scroll back to the beggining. I tried substituting the offset for document.body.scrollLetf and scrollTop but the result is the same, only this time the coordinates are 0,0. Am I doing something wrong? Or is this some IE bug? Is there a way around it or some other function I can use and achieve the same results? On another note, I did other two navigating options for the user in this section of the site, one is to click and drag anywhere on the screen to move it: $("html").mousedown(function(e) { var initx=e.pageX var inity=e.pageY $(document).mousemove(function(n) { var x_inc= initx-n.pageX; var y_inc= inity-n.pageY; window.scrollBy(x_inc*0.7,y_inc*0.7); initx=n.pageX; inity=n.pageY //$("span").text(initx+ "," +inity+ "," +x_inc+ "," +y_inc+ "," +e.pageX+ "," +e.pageY+ "," +n.pageX+ "," +n.pageY); // cancel out any text selections document.body.focus(); // prevent text selection in IE document.onselectstart = function () { return false; }; // prevent IE from trying to drag an image document.ondragstart = function() { return false; }; // prevent text selection (except IE) return false; }); }); $("html").mouseup(function() { $(document).unbind('mousemove'); }); The only part of this code I didn't write was the preventing text selection lines, these ones I found in a tutorial about clicking and draging objects, anyway, this code works fine on Chrome, FireFox and IE, though on Firefox and IE it's more often to happen some moviment glitches while you drag, sometimes it seems the "scrolling" is a litlle jagged, it's only a visual thing and not that much significant but if there's a way to prevent it I would like to know.

    Read the article

  • Scroll Position in a Table Body

    - by Craig Walker
    I want to implement infinite scrolling (with an AJAX-based loader) in an HTML table body. My HTML looks something like this: <table> <thead> <tr><th>Column</th></tr> </thead> <tbody> <tr><td>Row 1</td></tr> <tr><td>Row 2</td></tr> </tbody> </table> I get a scroll bar on the <tbody> like so: tbody { height:10em; /* Otherwise the tbody expands to fit all rows */ overflow:auto; } To be able to do anything when the user scrolls to the bottom, I need to be able to get the scroll position of the <tbody>. In all of the (jQuery) infinite scroll implementations I've seen (such as this one), they subtract the content height from the container height and compare it to the .scrollTop() value. Unfortunately this may not work with <tbody>, which is both the viewport and the container for the scrolled content. $("tbody").height() returns the viewable (ie: "shrunken") size, but I don't know how I can get the full (viewable + hidden) size of the table body. (FWIW, $("tbody").scrollTop() returns a "large" number when scrolled to the bottom, exactly as I would expect it to). Is there any way to accomplish this?

    Read the article

  • Add incremental numbers at the end of a string in a loop in Javascript.

    - by Kyle Sevenoaks
    This Javascript is part of a Foreach loop. var stickytooltip={ tooltipoffsets: [20, -30], //additional x and y offset from mouse cursor for tooltips fadeinspeed: 200, //duration of fade effect in milliseconds rightclickstick: false, //sticky tooltip when user right clicks over the triggering element (apart from pressing "s" key) ? stickybordercolors: ["#0a5692", "#0a5692"], //border color of tooltip depending on sticky state stickynotice: ["Press \"s\"", "or right click", "to sticky box"], //customize tooltip status message stickynotice2: "Click outside this box to hide it", //customize tooltip status message //***** NO NEED TO EDIT BEYOND HERE isdocked: false, positiontooltip:function($, $tooltip, e){ var x=e.pageX+this.tooltipoffsets[0], y=e.pageY+this.tooltipoffsets[1] var tipw=$tooltip.outerWidth(), tiph=$tooltip.outerHeight(), x=(x+tipw>$(document).scrollLeft()+$(window).width())? x-tipw-(stickytooltip.tooltipoffsets[0]*2) : x y=(y+tiph>$(document).scrollTop()+$(window).height())? $(document).scrollTop()+$(window).height()-tiph-10 : y $tooltip.css({left:x, top:y}) }, showbox:function($, $tooltip, e){ $tooltip.fadeIn(this.fadeinspeed) this.positiontooltip($, $tooltip, e) }, hidebox:function($, $tooltip){ if (!this.isdocked){ $tooltip.stop(false, true).hide() $tooltip.css({borderColor:'black'}).find('.stickystatus:eq(0)').css({background:this.stickybordercolors[0]}).html(this.stickynotice) } }, docktooltip:function($, $tooltip, e){ this.isdocked=true $tooltip.css({borderColor:'darkred'}).find('.stickystatus:eq(0)').css({background:this.stickybordercolors[1]}).html(this.stickynotice) }, init:function(targetselector, tipid){ jQuery(document).ready(function($){ var $targets=$(targetselector) var $tooltip=$('#'+tipid).appendTo(document.body) if ($targets.length==0) return var $alltips=$tooltip.find('div.atip') if (!stickytooltip.rightclickstick) stickytooltip.stickynotice[1]='' stickytooltip.stickynotice=stickytooltip.stickynotice.join(' ') stickytooltip.hidebox($, $tooltip) $targets.bind('mouseenter', function(e){ $alltips.hide().filter('#'+$(this).attr('data-tooltip')).show() stickytooltip.showbox($, $tooltip, e) }) $targets.bind('mouseleave', function(e){ stickytooltip.hidebox($, $tooltip) }) $targets.bind('mousemove', function(e){ if (!stickytooltip.isdocked){ stickytooltip.positiontooltip($, $tooltip, e) } }) $tooltip.bind("mouseenter", function(){ stickytooltip.hidebox($, $tooltip) }) $tooltip.bind("click", function(e){ e.stopPropagation() }) $(this).bind("click", function(e){ if (e.button==0){ stickytooltip.isdocked=false stickytooltip.hidebox($, $tooltip) } }) $(this).bind("contextmenu", function(e){ if (stickytooltip.rightclickstick && $(e.target).parents().andSelf().filter(targetselector).length==1){ //if oncontextmenu over a target element stickytooltip.docktooltip($, $tooltip, e) return false } }) $(this).bind('keypress', function(e){ var keyunicode=e.charCode || e.keyCode if (keyunicode==115){ //if "s" key was pressed stickytooltip.docktooltip($, $tooltip, e) } }) }) //end dom ready } } //stickytooltip.init("targetElementSelector", "tooltipcontainer") stickytooltip.init("*[data-tooltip]", "mystickytooltip") I need to just add some code to the end of "mystickytooltip" to add 1, 2, 3, 4 each time it loops. My JS-foo is nonexistant, please help :)

    Read the article

  • Right Click Context Menu Script for iFrame

    - by Ramiz Uddin
    The context of the problem is related to an application which is based on single-page Ajax application which consists of three different panels (iframes). The layout of the page is as follows: _________________________________________________ | | | Frame A | FRAME C |__________________| | | | Frame B | | | | | | | | | | | | | | | The problem is with the context menu (right-click menu) in Frame C. The position of the context menu is not perfectly positioned with the mouse click. Particularly, if you drag and increase the size of the Frame C window. Code snippet: var rightedge = parent.frames["FrameC"].frameElement.clientWidth-event.clientX; var bottomedge = parent.frames["FrameC"].frameElement.clientHeight-event.clientY; if (rightedge < document.getElementById('Menu').offsetWidth) menuCoorX = parent.frames["FrameC"].frameElement.scrollLeft + event.clientX - document.getElementById('Menu').offsetWidth; else menuCoorX = parent.frames["FrameC"].frameElement.scrollLeft + event.clientX; if (bottomedge < document.getElementById('Menu').offsetHeight) menuCoorY = parent.frames["FrameC"].frameElement.scrollTop + event.clientY - document.getElementById('Menu').offsetHeight; else menuCoorY = parent.frames["FrameC"].frameElement.scrollTop + event.clientY; Currently, we need it to work only for IE (7 and 8). Please, help! Thanks.

    Read the article

  • jQuery scrolling UL with hidden overflow

    - by papermate
    I have a UL with LI's set to display horizontally. The UL has a fixed width and it's set to hide the overflow. This is so I can display my images, which are to be used in a gallery, neatly. It works and looks nice. I want to, however, use jQuery to scroll the contents of the UL rather than set the overflow property to auto and be presented with those ugly scroll bars. I recycled some code I used to do the same thing a few weeks back but, back then, I was doing it in DIV's. Much easier, apparently. $('.gallery_container span').hover( function() { if ($(this).attr('class') == 'up') direction = '-='; else direction = '+='; var divOffset = $('ul.gallery').offset().top; $('ul.gallery').animate({scrollTop: direction + divOffset}, 5000); }, function() { $('ul.gallery').stop(); }); I saw a site that says the scrollTop property can be applied to UL's. So I'm not sure what exactly is causing this not to work. Any ideas? EDIT: Found what was causing it to not work at all but not it scrolls vertically - Kind of expected that. Is there any way to scroll it horizontally?

    Read the article

  • Trying to draw a dynamic rectangle in SVG

    - by Shaun
    To be more specific, here are the steps I need: onmousedown - set x and y of rect as mouse coordinates onmousemove - using the current x and y mouse coordinates calculate height and width of the rect, set these and append onmouseup - remove the rectangle, and call a function based off some calculations from the rect. Here is what I have but isn't quite working (right now I have it drawing a line to make it simpler): onmousedown: startbox(evt) function startbox(evt) { if(evt.button === 0) { x1 = evt.clientX + div.scrollLeft-5; y1 = evt.clientY + div.scrollTop-30; obj.setAttributeNS(null, "x1", x1); obj.setAttributeNS(null, "y1", y1); Root.setAttributeNS(null, "onmousemove", "updatebox(evt)"); } } onmousemove: updatebox(evt) function updatebox(evt) { if(evt.button === 0) { x2 = evt.clientX + div.scrollLeft-5; y2 = evt.clientY + div.scrollTop-30; Root.appendChild(.obj); w = Math.abs(x2-x1); h = Math.abs(y2-y1); var strokecolor; if(w>20 && h>20) { strokecolor = "green"; validbox = true; } else { strokecolor = "red"; validbox = false; } var Attr={ x2:x2, y2:y2, stroke:strokecolor } assignAttr(obj, Attr); //just loops thru adding multiple attributes } } onmouseup: endbox() function endbox(evt) { if(evt.button===0) { Root.setAttributeNS(null, "onmousemove", ""); Root.removeChild(obj); if(validbox) { //do stuff validbox = !validbox; } } } Some of my problems with this are: Its slow in Chrome making drawing the line/rect feel sluggish. It won't work two times in a row. This is the real problem that I can't fix. Any and all feedback is welcome.

    Read the article

  • bind event handler on keydown listen function JavaScript jQuery

    - by user1644123
    I am trying to bind a handler to an event. The event is a keydown function. The handler will listen for hit variables to produce one of two conditions. The 1st condition (odd number of hits) will perform 1 function, the 2nd (even number of hits) will perform another function. To elaborate, the 1st function will scroll to one element, the 2nd will scroll to another element. My syntax may be the wrong approach, but it works for the 1st condition, but not the 2nd. I think I have the conditional statement in the wrong place. How can I rewrite this to work as intended? Thank you kindly, in advance! $(document).keydown(function(e) { switch (e.which) { case 37: break; case 38: break; case 39: break; case 40: //bottom arrow key var hits = 0; if (hits % 2 !== 0) { $('#wrap').animate({ scrollTop: $("#scrollToHere").offset().top }, 2800); } else { $('#wrap').animate({ scrollTop: $("#scroll2ToHere").offset().top }, 2800); } hits++; return false; break; } })? *I moved "var hits = 0;" to the top, but it only works! But is there a way I can reset the whole thing after every two hits? I want to reset because when there is a bug and if I press a 3rd time it scrolls to the very top of the page, where there is no element to make it scroll to the top. Why would it scroll to the top of the page if I never scripted it to do so?? *

    Read the article

  • Scrolling to the bottom of a div on page load: issue with syntaxhighlighter

    - by Rayne
    I've been using this code: var objDiv = document.getElementById("code"); objDiv.scrollTop = objDiv.scrollHeight; to scroll to the very bottom of the div. It worked perfectly in FF and Chrome (I asked a question about it not working in Chrome a few days ago, but it appears the guy who was testing it on Chrome was incorrect, so I tested it myself) until I started syntax highlighting the code that I put in the div with SyntaxHighlighter. Before, I was putting the code in a <p> and breaking lines with <br />, but the <br /> stuff doesn't fly with SyntaxHighlighter, so I replaced all of those with newlines (not entirely certain if this is important, but it's worth mentioning). Now, when the page loads, it does scroll, but not all the way down. It scrolls nearly to the bottom. I've tried all the methods listed in the other question I mentioned but they all do the same thing, or nothing at all. Is there anything else I can try? Here is the relevant piece of the generated HTML. Forgive the poor formatting, I'm not writing the HTML by hand, but rather using Hiccup with Clojure, and it doesn't bother with formatting. <div class="scroll" id="code"><pre class="brush: clojure">=> (doseq [x (range 1 100)] (println x)) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 nil </pre></div><script type="text/javascript">var objDiv = document.getElementById("code"); objDiv.scrollTop = objDiv.scrollHeight;</script>

    Read the article

  • How can I differentiate a manual scroll (via mousewheel/scrollbar) from a Javascript/jQuery scroll?

    - by David Murdoch
    UPDATE: Here is a jsbin example demonstrating the problem. Basically, I have the following javascript which scrolls the window to an anchor on the page: // get anchors with href's that start with "#" $("a[href^=#]").live("click", function(){ var target = $($(this).attr("href")); // if the target exists: scroll to it... if(target[0]){ // If the page isn't long enough to scroll to the target's position // we want to scroll as much as we can. This part prevents a sudden // stop when window.scrollTop reaches its maximum. var y = Math.min(target.offset().top, $(document).height() - $(window).height()); // also, don't try to scroll to a negative value... y=Math.max(y,0); // OK, you can scroll now... $("html,body").stop().animate({ "scrollTop": y }, 1000); } return false; }); It works perfectly......until I manually try to scroll the window. When the scrollbar or mousewheel is scrolled I need to stop the current scroll animation...but I'm not sure how to do this. This is probably my starting point... $(window).scroll(e){ if(IsManuallyScrolled(e)){ $("html,body").stop(); } } ...but I'm not sure how to code the IsManuallyScrolled function. I've checked out e (the event object) in Google Chrome's console and AFAIK there is not way to differentiate between a manual scroll and jQuery's animate() scroll. How can I differentiate between a manual scroll and one called via jQuery's $.fn.animate function?

    Read the article

  • Been asked a dozen times, but no luck from what I've read. Prevent Anchor Jumping on page load

    - by jasenmp
    I'm currently working with WP theme that can be found here: sanjay.dmediastudios.com I'm currently using 'smooth scroll' on my page, I'm attempting to have the page smoothly scroll to the requested section when coming from an external link (for instance coming from the blog page takes you to sanjay.dmediastudios.com/#portfolio) from there I want the page to start at the top and THEN scroll to the portfolio section. What's happening is it briefly displays the 'portfolio section' (anchor jump) and THEN resets to the top and scrolls down. It's driving me nuts :(. Here is the code I'm using: Click function for smooth scroll: $(function() { $('.menu li a').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) { $root.animate({ scrollTop: target.offset().top - 75 }, 800, 'swing'); return false; } } }); //end of click function }); The page load function: $(window).on("load", function() { if (location.hash) { // do the test straight away window.scrollTo(0, 0); // execute it straight away setTimeout(function() { window.scrollTo(0, 0); // run it a bit later also for browser compatibility }, 1); } var urlHash = window.location.href.split("#")[1]; if (urlHash && $('#' + urlHash).length) $('html,body').animate({ scrollTop: $('#' + urlHash).offset().top - 75 }, 800, 'swing'); }); Any help would be MUCH appreciated.

    Read the article

  • jQuery : how to determine that a div is scrolled down

    - by subtenante
    I have a div with defined height, and overflow:scroll;. Its content is too long so scrollbars appear. Now for the ichy part. Some of its inner HTML strangely appears all the time (to be precise, the footer of a table generated by the tableFilter plugin). I'd like to make this footer disappear when it is not needed (it actually appears out of the containing <div>'s border). I resolved to make it disappear but setting its z-index to -1000. But I want to make it appear when the containing <div> is totally scrolled down. How can I know the user has scrolled at the bottom ? Using the help from answers below, I used scrollTop attribute but the difference between scrollTop and innerHeight is the size of the scrollbar plus some unidentified delta. A scrollbar is 16 pixels high in most browsers under Windows, but I get a difference of 17 in Firefox and something like 20 in IE, where my <div> content's borders seems to be rendered bigger. A way (actually two ways...) to compute the scrollbar size has been given there.

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >