scrollto

cancel a submit in jquery?

谁说胖子不能爱 提交于 2019-11-30 21:35:23
im doing a form validation and I want to validate the input fields when "on submit" if error Im using jquery.scrollTo to go to error: $('#form_inscripcion').submit(function() { //se traen todos los inputs del formulario var $inputs = $('#form_inscripcion :input'); $inputs.each(function() { var encontro_error = validar($(this)); //uses dependence ok if (encontro_error){ $.scrollTo( 'input#'+$(this).attr('id'), 800 ); //go to error return false; // dont submit!... but seems not enter here :( } }); }); The problem is, when error returned doesnt cancel the submit, doesnt run return false; line. It

jQuery accordion, scroll beginning of clicked tab to the top, doesn't work if expanded tab is above the one being clicked?

[亡魂溺海] 提交于 2019-11-30 07:25:19
Got a little bit of a problem with getting my jquery accordion to do what I want. I always want the tab that is being clicked to be scrolled to a fixed amount of pixels from the top of the page, and I kinda got it working. But whenever the active tab is above the tab being clicked and if the page already is scrolled down a bit, the top and parts of the content of the clicked tab is scrolled up past the top of the page. This is what i got: $(function() { $("#accordion").accordion({ autoHeight: false, collapsible: true, heightStyle: "content", active: 0, animate: 300 }); $('#accordion h3').bind(

cancel a submit in jquery?

扶醉桌前 提交于 2019-11-30 05:27:25
问题 im doing a form validation and I want to validate the input fields when "on submit" if error Im using jquery.scrollTo to go to error: $('#form_inscripcion').submit(function() { //se traen todos los inputs del formulario var $inputs = $('#form_inscripcion :input'); $inputs.each(function() { var encontro_error = validar($(this)); //uses dependence ok if (encontro_error){ $.scrollTo( 'input#'+$(this).attr('id'), 800 ); //go to error return false; // dont submit!... but seems not enter here :( }

check if element got scrolled to top

风流意气都作罢 提交于 2019-11-30 03:39:15
I want to check if an element is scrolled to top with an offset of ~ 100px. I´ve got a page with 5 subcontents and 2 classes to make backgrounds. It looks like this: <div class="background1"> Content1 </div> <div class="background2"> Content2 </div> <div class="background1"> Content3 </div> <div class="background2"> Content4 </div> <div class="background1"> Content5 </div> Now i want to check, when one of these classes reaches the top by scrolling This is one of my last trys: $('.background1', '.background2').position(function(){ if($(this).position().top == 100){ alert('checkThis'); } }); I

ScrollTo with animation

♀尐吖头ヾ 提交于 2019-11-29 04:08:55
how can i add an easing/animation/slowly moving to this function? At the moment it just jumps. Now it should move to the "anchor" with an animation. <script type='text/javascript'> setTimeout("window.scrollBy(0,270);",3000); </script> also possible with plain javascript using request animation frame.. // first add raf shim // http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ window.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function( callback ){ window.setTimeout(callback

UITableView scrollToRowAtIndexPath not working for last 4

你离开我真会死。 提交于 2019-11-29 01:30:50
问题 I am in a UITableViewController and I have textfields inside cells. When the user clicks on the textfield, I implement the UITextFieldDelegate and in method textFieldDidBeganEditing I determine the index of the cell and scroll to that position. It works perfectly for all cells expect for the last 4-5 cells. What am I doing wrong? Thanks. 回答1: scrollToRowAtIndexPath: method scrolls the cell to UITableViewScrollPositionTop or UITableViewScrollPositionMiddle only if the tableView's contentSize

check if element got scrolled to top

≡放荡痞女 提交于 2019-11-29 01:13:32
问题 I want to check if an element is scrolled to top with an offset of ~ 100px. I´ve got a page with 5 subcontents and 2 classes to make backgrounds. It looks like this: <div class="background1"> Content1 </div> <div class="background2"> Content2 </div> <div class="background1"> Content3 </div> <div class="background2"> Content4 </div> <div class="background1"> Content5 </div> Now i want to check, when one of these classes reaches the top by scrolling This is one of my last trys: $('.background1'

Highlight active link when using scrollto based on current view

非 Y 不嫁゛ 提交于 2019-11-28 21:52:13
I have a website which is one page and the user navigates to each section using links which uses the scrollto jquery plugin. My problem is: I want to show the active link in the main menu. So if you scroll to the contact form the contact link is highlighted. Now I could do this in jquery by adding the class after clicking. If done like that if a user was to manually scroll to another section the contact link would still be active, which would be incorrect and misleading. So my thoughts would be to somehow work out which div id is currently in view. I don't really understand how to do that

jQuery.ScrollTo / jQuery.SerialScroll Horizontal Scrolling

别等时光非礼了梦想. 提交于 2019-11-28 19:57:56
I am looking to implement horizontal scrolling using jQuery.SerialScroll (based on jQuery.ScrollTo ). I currently have a continuous horizontal scrolling working with liScroll as I discuss in this post . However, now I need discrete scrolling and I have SerialScroll working perfectly for vertical scrolling. For some reason, if the 'axis' property is specified as 'x' nothing happens. I can't even get the SerialScroll example for right to left scrolling to work. I have HTML like this: <div id="pane"> <div>Item 1</div> <div>Item 2</div> <div>Item 3</div> </div> I have jQuery like this, that works

How do you animate FB.Canvas.scrollTo?

佐手、 提交于 2019-11-28 18:01:20
I've created an app that is a set size (around 2,000 px tall) and have a menu that calls FB.Canvas.scrollTo in order to help the user navigate the long page. Is there any way to add a smooth scrolling effect? Facebook does not offer any solution on its developer blog. Dave Using @Jonny's method, you can do this a little more simply with function scrollTo(y){ FB.Canvas.getPageInfo(function(pageInfo){ $({y: pageInfo.scrollTop}).animate( {y: y}, {duration: 1000, step: function(offset){ FB.Canvas.scrollTo(0, offset); } }); }); } JonnyReeves Just had the same problem today - I came up with a little