Tuesday, July 31, 2012

javascript – Make items visible with button



I have this javascript code:



function newsOverview() {
$(\".list-news li:gt(3)\").hide();
$(\".box-news .btn-1\").on(\'click\', function(e){
e.preventDefault;
$(\".list-news li:visible:last\").nextAll(\":lt(4)\").fadeIn(600);
});
};


I have a big list with li items. This script is showing every time 4 li items. When you clicking on the btn-1 button. But now i have a question with this script.



  • Why the e.preventDefault is not working? When i clicking the button. I scrolling back to the top of the page. Why does that is not working?

  • And, Is it possible. When all items are visible. That the button disappears.






Rating: 3 out of 5 based on 3 ratings



The post javascript – Make items visible with button appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/javascript-make-items-visible-with-button.html

No comments:

Post a Comment