jquery - Is it possible to change the cursor on an element without refreshing the page? -


i have carousel scrolling through slides. carousel has overlay higher z-index content beneath it. slides contain links, don't. jquery gets href of slides link , makes overlay link href when clicked.

[slide 1: <p>] [slide 2: <p> <a>] 

my problem is, want change cursor pointer when slide contains link , cursor auto when there no link. (the change won't matter when user hovering on carousel, because slides don't automatically move when case)

i have click function stops overlay linking anywhere when there no link, cursor controlled css. tried using addclass, isn't working.

is possible change cursor hover state on same div using jquery , css?

this piece of function stops overlay doing if there no link:

$('#carousel_overlay').click(function() {     slidelinktarget = promoslides.eq(activeslideindex).find('a').attr('href');      if (!slidelinktarget == '') {             window.open(slidelinktarget);          ('#carousel_overlay').addclass('link');     } else {         return false;            $('#carousel_overlay').removeclass('link');             }             }); 

(i know click function , won't work if want cursor change on hover)

#carousel_overlay{cursor: auto;} #carousel_overlay.link{cursor: pointer;} 

cheers

you can add hover script overlay , set pointer on if condition (href != "" in example) matches.

$(function() {    $('overlay').hover( function() {       // selector should match link       if ( $('image').attr('href') != "" ) {          $(this).css('cursor', 'pointer');       }    },    function() {       $(this).css('cursor', 'default');    }); }); 

maybe wont work copy & paste, because not know html.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -