I am making a skill set page with Embedded Content, and i am trying to make a progressbar with the percentage of each skill I entered. But the problem is, all the bars acquire the lastest percent value added. (or in reverse order O.o)
This happens because all your bars get the same class name (.skillBar) so the last chunk of JavaScript emitted will set the value for all bars.
You really shouldn't generate huge amounts of JavaScript with XSLT - ideally, you would set some values and have a single chunk of JavaScript perform everything when the page is rendered - try this approach instead:
I've highlighted the spot that may need attention - I've not tested this, but standard jQuery plugins will set the this variable to the current item, so you should be able to grab the value of the data-value attribute set in the for-each earlier. You may need to do $(this) instead - or check the docs for the progressbar plugin for how to access the jQuery item at that point.
Embedded Content Xslt + jQuery help
Hi guys,
I am making a skill set page with Embedded Content, and i am trying to make a progressbar with the percentage of each skill I entered. But the problem is, all the bars acquire the lastest percent value added. (or in reverse order O.o)
Here is the page :
http://djan.se/about/my-skill-set.aspx
And my Xslt/JS :
Can anyone tell me what I am doing wrong here? =)
Kind Regards,
Djan
And here is the XSLT/JS for the reversed order :
Hi Djan,
This happens because all your bars get the same class name (.skillBar) so the last chunk of JavaScript emitted will set the value for all bars.
You really shouldn't generate huge amounts of JavaScript with XSLT - ideally, you would set some values and have a single chunk of JavaScript perform everything when the page is rendered - try this approach instead:
I've highlighted the spot that may need attention - I've not tested this, but standard jQuery plugins will set the this variable to the current item, so you should be able to grab the value of the data-value attribute set in the for-each earlier. You may need to do $(this) instead - or check the docs for the progressbar plugin for how to access the jQuery item at that point.
/Chriztian
is working on a reply...