How do I add jquery plugins to specific div?
-
Firts of all, sorry for my english.
Hello, I’m fairly new with jquery and I can’t find a proper answer to what I need.
The thing is, I want to use a jquery plugin but I can’t get it to work…The plugin name is Sticky (https://stickyjs.com/).
1 – I put the script in the JS folder
2 – I put the following code in functions.php:wp_register_script(‘sticky’, get_template_directory_uri() . ‘/js/jquery.sticky.min.js’, array(‘jquery’), ”, true);
wp_enqueue_script(‘sticky’);
And here’s my problem. What should I do to make the plugin with a specific div?? Stupid question, I know.
Should I change the .js file (changing default things to certain div id)?
Should I use a script in CSS for the # selector?
Is it something else I’m missing?I’m working with a child-theme, by the way.
Please explain me like you’re talking to a 5 year old ??
Thanks in advance!EDIT:
Here’s the code I want to stick (just some ads in the sidebar)
// html
<div id=”stick-it”>
<div id=”sky-ad”>
<script>
(ADSENSE CODE)
</script>
</div>
</div>//CSS
#sky-ad {
background: #fff;
border: 1px solid #ddd;
padding: 5px;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
width: 300px;
haight: 600px;
float: none;}
- The topic ‘How do I add jquery plugins to specific div?’ is closed to new replies.