How to use Jquery side library with zk ?

asked 2015-11-24 13:54:05 +0800

WilliamB gravatar image WilliamB
1609 1 6

updated 2015-11-24 14:01:23 +0800

I'm trying to build a simple timeline from a simple slide. I went with http://bxslider.com/ as it has all the option i need.

I'm making a custom component that will generates "li" for each of the entry of my model.

The issue is I will have several of those timeline on one page. So I'm trying to use the jq selector from uuid. First issue, UL being a native component, id will not be generating a uuid. So I've added a container

in which I'll add the UL in java.

Now my problem is when I use the jq selector i get anerror :

If in my JS I use the default jquery selector it works :


But when i use the jq selector with the id!

jq('$container > ul').bxSlider();

"Uncaught TypeError: jq(...).bxSlider is not a function"

Same issue with jq('ul.bxslider')

When i evaluate both of those in the console i do get the slider ul though ... So how can i call external Jquery lib method from the zk jquery selector?


delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2015-11-25 10:53:28 +0800

afxgroup gravatar image afxgroup
126 1

"Uncaught TypeError: jq(...).bxSlider is not a function" means that bxSlider is not loaded correctly

1) Ensure that js lib is loaded and make sure that is like all javascript files at bottom of your file 2) Ensure that you call the function you are calling is in a zk.afterMount() because you are not sure that an object is totally loaded

link publish delete flag offensive edit


Thanks for your message.I was doing both of those correctly. Hence why it worked when i replaced jq by $.

WilliamB ( 2015-11-25 11:26:16 +0800 )edit

answered 2015-11-24 14:29:08 +0800

WilliamB gravatar image WilliamB
1609 1 6

Ended up retrieving the generated ID from the ZK uuid selector then called the Jquery selector.

But this is weird ...

var contUuid = '#' + jq('$container')[0].id;

$(contUuid + ' ul.bxslider').bxSlider();

There are to be something cleaner ...

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2015-11-24 13:54:05 +0800

Seen: 57 times

Last updated: Nov 25 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More