Reputation: 3
I am working on taking a current site and turning it into a drupal site. I am working with Javascript that was written before so I'm trying to slightly modify it to work.
Currently wherever there is a paragraph tag it inserts a class. I want to fine tune it so it only adds to class to the paragraph tag within a certain div class "submenu". Any suggestions how I can achieve that?
this is the current site functionality: http://gattimorrison.com/manufacturers.php
The JS
<script type="text/javascript">
$(document).ready(function() {
$(document).find("p").each(function(i) {
$(this).addClass("imgMa"+i);
$(this).hover(function() {
$("#nameMa"+i).addClass("red");
$("#nameMa"+i).append("<span class='dot'> </span>");
$(this).removeClass("imgMa"+i);
$(this).addClass("imgMa"+i+"_on");
}, function() {
$("#nameMa"+i).removeClass("red");
$("span.dot").remove();
$(this).removeClass("imgMa"+i+"_on");
$(this).addClass("imgMa"+i);
});
});
$(document).find("li").each(function(i) {
$(this).hover(function() {
$(this).addClass("red");
$(this).append("<span class='dot'> </span>");
$("#imgMa"+i).removeClass("imgMa"+i);
$("#imgMa"+i).addClass("imgMa"+i+"_on");
}, function() {
$(this).removeClass("red");
$("span.dot").remove();
$("#imgMa"+i).removeClass("imgMa"+i+"_on");
$("#imgMa"+i).addClass("imgMa"+i);
});
});
});
</script>
Thanks!
Upvotes: 0
Views: 106
Reputation: 2060
Just change the selector that targets the p.
$(document).find(".submenu p").each(function(i) {
Upvotes: 2