css - Add classes to adjacent elements dynamically on mouseenter -


I am creating a grid of elements and using the CSS transition for each element, hover effect in place. I would also like to add secondary effects on adjacent X- and Y-axis elements, which would cause cloud effect. I think I am referring to those elements by using jQuery's next () and prev () methods, or $ index and $ parent $ $ index.

The grid area will be enough to prevent line-wrapping (using negative margins and hidden overflow).

This is a simple example of my repeat:

  & lt; Div class = "activity-thumb-line" ng-repeat = "INNERRA in (20) $ track by index" & gt; & Lt; Div class = "activity-thumb" ng-square = "{adjacent}: adjacent}" ng-repeat = "jam in namarra (30) $ index" ng-mouseenter = "highlights activitivity ()" & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

and a function in the controller (which I know may not be the best way):

  $ scope.highlightActivities = function () { $ (This) .next () Adjacent = true; $ (This) .prev () Adjacent = true;   

How can I target elements around the hovered element using ng-class (or something) ng-repetitive?

  • Div>

    Here is an instruction that can be used by all indices of adjacent cells Calculates and adds adjacent squares using only jQuery ... not a ng-square

    It assumes that the rows will wrap, adjustments for individual line elements will be required

     . Directive ('activity call', function) (return {restricted: 'c', link: function (scope, amm) {elem.bind ('mouseenter', function (e) {var elW = elem.width (), $ parent = Elem.parent (), parentW = $ parent.width (), $ items = $ parent.children (), num_tems = $ items.length itemsPerRow = Math.floor (parentW / elW), idx = elem.index () , RowIndex = idx% item pyorove; / * object of various indices, * / var sitenside id x = {top: idx> item idx - itemsPerRow: wrong, right: rowIndex! = ItemsPerRow? Idx + 1: wrong, left : Line indexx; 0? Idx - 1: wrong, bottom: (numItems - idx)> item IDX + Items Parow: False] Console der (adjacent IDX); $ Items.removeClass ('adjacent') $ .each (adjacentIdx, work (status, index) {if (index! == false) {$ items.eq ( Index) .addClass ('adjacent');}});});}}});  

    This will not take much overuse to remove jQuery dependency.

    In addition to this, additional instructions will be required to remove additional classes of the mouse when the mouse leaves the main parent one by


    Comments

    Popular posts from this blog

    python - Overriding the save method in Django ModelForm -

    html - CSS autoheight, but fit content to height of div -

    qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -