[jQuery] jQuery Pagination - Return to top of screen
jQuery Pagination works great, but when you click for the next set of results the window does not return to the top (if you have to scroll to get to the pagination). would anyone have any ideas on how to force the window scroll back to the top on click? - function pageselectCallback(page_index, jq){ var new_content = $('#hiddenresult div.result:eq('+page_index +')').clone(); $('#Searchresult').empty().append(new_content); return false; } function initPagination() { var num_entries = $('#hiddenresult div.result').length; // Create pagination element $(#Pagination).pagination(num_entries, { num_edge_entries: 10, num_display_entries: 8, callback: pageselectCallback, items_per_page:1 }); } // Load HTML snippet with AJAX and insert it into the Hiddenresult element // When the HTML has loaded, call initPagination to paginate the elements $(document).ready(function(){ initPagination(); });
[jQuery] Re: jQuery Pagination - Return to top of screen
Works great, thank you. On Nov 12, 4:30 pm, Andrei Eftimie k3liu...@gmail.com wrote: would anyone have any ideas on how to force the window scroll back to the top on click? function pageselectCallback(page_index, jq){ var new_content = $('#hiddenresult div.result:eq('+page_index+')').clone(); $('#Searchresult').empty().append(new_content); window.scroll(0,0); return false; } -- Andrei Eftimiehttp://eftimie.com +40 758 833 281 Puncthttp://designpunct.ro
[jQuery] Delay keyup
Hello In the following code, I would like it delay the keyup. Does anyone have an idea? $(#search_query).bind(keyup, function(e){ $(#quickresults).slideDown(fast); $.post(http://www.wesbite.com;, {search_query: $(e.target).val()}, function(result_list){ $(#quickresults *:not(h3)).remove(); $(#quickresults).append(result_list); }); });
[jQuery] Re: Hover Area - Change image
OK! we're close... If I attach this to a variable and echo it out, it give's me the correct string. The _off is replaced with _over and the other way around. As I have it below, on hover, the image will not change, no errors (firebug), just doesn't do anything. $('li.clickable').hover(function() { $(this).find('img').attr('src').replace(_off,_over); }, function() { $(this).find('img').attr('src').replace(_over,_off); });
[jQuery] Re: Hover Area - Change image
That worked, thank you so much! On Aug 26, 11:56 am, Leonard Martin leonard.mar...@gmail.com wrote: You're not actually setting the source once you've replaced it: $('li.clickable').hover(function() { $(this).find('img').attr('src', $(this).find('img').attr ('src').replace(_off,_over));}, function() { $(this).find('img').attr('src', $(this).find('img').attr ('src').replace(_over,_off)); }); It might be worth setting a variable to $('li.clickable').find('img') as well since it's used 4 times in there, just to reduce overhead. On Aug 26, 4:44 pm, wheatstraw psurr...@gmail.com wrote: OK! we're close... If I attach this to a variable and echo it out, it give's me the correct string. The _off is replaced with _over and the other way around. As I have it below, on hover, the image will not change, no errors (firebug), just doesn't do anything. $('li.clickable').hover(function() { $(this).find('img').attr('src').replace(_off,_over);}, function() { $(this).find('img').attr('src').replace(_over,_off); });
[jQuery] Hover Area - Change image
What I want to have happen is when you hover over the li it: 1) allows you to click the who area (this works) 2) The image swap. Right now the image will only swap when hovering over the image not the rest of the li. Any help would be appreciated! $(document).ready(function(){ $('li.clickable').css('cursor', 'pointer').click(function() { window.location = $('a', this).attr('href'); }); $(li.clickable img).hover(function() { $(this).attr(src, $(this).attr(src).split(_off).join (_over)); }, function() { $(this).attr(src, $(this).attr(src).split(_over).join (_off)); }); });
[jQuery] Re: Hover Area - Change image
Thanks but it doesn't seem to work... li class=clickableimg src=http://localhost/wrt-demo/images/ projects/boxes/13_off.jpg alt=Abuja Master Plan / p class=entryTexta href=http://localhost/wrt-demo/projects/detail/ Abuja-Master-Plan/13Abuja Master Plan/a/p/li $(.clickable).hover(function() { $(this).children(img).attr(src, $(this).attr(src).split (_off).join(_over)); }, function() { $(this).children(img).attr(src, $(this).attr(src).split (_over).join(_off)); }); This works but not what I was trying to achieve: $(.clickable img).hover(function() { $(this).attr(src, $(this).attr(src).split(_off).join (_over)); }, function() { $(this).attr(src, $(this).attr(src).split(_over).join (_off)); }); On Aug 25, 10:52 am, Liam Potter radioactiv...@gmail.com wrote: It's because you have targeted the image as the hover area rather then the li, use this instead $(li.clickable).hover(function() { $(this).children(img).attr(src, $(this).attr(src).split(_off).join(_over));}, function() { $(this).children(img).attr(src, $(this).attr(src).split(_over).join(_off)); }); Hover over the li, then get the child element within the context of 'this' to perform the actions to it. wheatstraw wrote: What I want to have happen is when you hover over the li it: 1) allows you to click the who area (this works) 2) The image swap. Right now the image will only swap when hovering over the image not the rest of the li. Any help would be appreciated! $(document).ready(function(){ $('li.clickable').css('cursor', 'pointer').click(function() { window.location = $('a', this).attr('href'); }); $(li.clickable img).hover(function() { $(this).attr(src, $(this).attr(src).split(_off).join (_over)); }, function() { $(this).attr(src, $(this).attr(src).split(_over).join (_off)); }); });