English 中文(简体)
用jquery对一个古怪的列表进行编号
原标题:numbering a funk-olicious list with jquery

我使用<code>.scrollable</code>为我的客户滚动一堆科学论文(除此之外),我需要一个jquery参数来对各个div条目进行编号,如下所示

html中的第一个条目

36.
37.
38
39.
40
31
32
33
34
35
28
29
30
31
32
etc.

im当前正在使用

$(window).load(function(){  
        $(".scrollable").scrollable({ vertical: true, mousewheel: true});               

    var increment=-1;
   var start=40; // THIS CONTROLS THE NUMBERING OF THE INDIVIDUAL PAPERS OR IP ENTRIES, CHANGE start=# TO THE NUMBEER THAT YOU WANT THE FIRST ENTRY TO HAVE
    $("div.item-number-ip").each(function(i) {
       $(this).prepend( <span> +(start+i*increment).toString()+ .</span> );
       });  
});                                

但很明显,这只是从40到1的数字……客户希望人们滚动他的文章,从最近的40-35开始,但他希望40列在第一页的底部,而不是顶部。

问题回答

我认为这是你想要的,但有点不清楚:

http://jsfiddle.net/6e6md/

我认为你的数字示例列表中的最后5个数字是错误的。如果没有,我不确定你在找什么。

这需要根据您的确切代码进行调整,但我认为这给出了您想要的编号排序。





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签