0

I'm very new to drupal. I'm using drupal 7 with ckeditor. I've created one block with 3 views (Link, Image, Link) in it and I've wrote jQuery on 2 links. Then, I've developed second block with same type of views and wrote same jQuery for 2 links in this new block.

But I found (in FireFox using FireBug addon) that all links have same node id. views-field-view-node for 1st link and views-field-view-node-1 for second link for both blocks. So when I click on 1 block's 1st link, action fires in both blocks because drupal received same link id for another block also.

How can I change/modify this node id of view? So I can give separate action.

Used jQuery:

drupal_add_js("jQuery(document).ready(function() {
    // change slideshow with your view name
    jQuery('.view-slideshow .view-content').cycle({
        fx: 'fade',
        speed:  'fast', 
        timeout: 3000, 
        next:   '.views-field-view-node-1', // problem is here. This id is same for both block's link
        prev:   '.views-field-view-node' 
    });
});", 'inline');

Thanks in advance....

  • could you post the relevant jQuery code and the views out put here – Mohammed Shameem Jan 25 '13 at 10:25
  • You dont want to be working with node ids for presentation. – Alex Gill Jan 25 '13 at 10:42
  • Could you please clarify what you are doing..? – SGhosh Jan 25 '13 at 10:53
  • @SGhosh what part of question you don't understand? – Never Quit Jan 25 '13 at 10:55
  • Sorry, but not much is clear to me..example "one block with 3 views" and "second block with same type of views" – SGhosh Jan 25 '13 at 11:00
1

This is not a Drupal related problem.

Your 'next' and 'prev' selectors are not specific enough. You should write also the parent block id.

Every block in a page has a unique id attribute in HTML. You should find stuff like

<div id="block-3" class="block">

wrapping your slideshow.

Just declare a more specific jQuery selector, adding the block id.

Here's a modification for your code, assuming that the block has a "block-3" id:

drupal_add_js("jQuery(document).ready(function() {
    // change slideshow with your view name
    jQuery('.view-slideshow .view-content').cycle({
        fx: 'fade',
        speed:  'fast', 
        timeout: 3000, 
        next:   '#block-3 .views-field-view-node-1', // added a 'parent child' jquery selector
        prev:   '#block-3 .views-field-view-node' 
    });
});", 'inline');
| improve this answer | |
  • bingo.. thanks a lot... perfectly solved the problem. – Never Quit Feb 22 '13 at 9:14
0

From the link you shared...looks like you need a slideshow. - You could simply use Views and Views Slideshow for your purpose.

Hope it helps. If not please do add your comments. I'll try to help if I can. :)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.