Results 1 to 9 of 9

Thread: div id/class not reacting when...

  1. #1
    Join Date
    Jun 2007
    Posts
    64
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Arrow div id/class not reacting when...

    ... it is appended to the body by javascript (jquery) !!


    well here is the line in my JS

    Code:
    config.$rightnavbutton=$('<div id="resizeme" class="resizeme"><img id="resizeme" class="resizeme" src="'+config.defaultbuttons.rightnav[0]+'"></div>').css({zIndex:50,position:'absolute',left:config.offsets.left+config.$gallery.get(0).offsetWidth+config.defaultbuttons.rightnav[1]+'px',top:config.offsets.top+config.defaultbuttons.rightnav[2]+'px',cursor:'hand',cursor:'pointer'}).attr({title:''}).appendTo('body')
    as you can see i put the div and img into id and class (for testing purpose) but if i try to manipulate that stuff via my style.css, it isnt reacting....


    this is a part of my stylesheet which should work in a normale case

    Code:
    #resizeme img {
    width:40;
    }
    #resizeme img:hover {
    width:47;
    }

    but it doesnt work... my css is ignored when ther page loads...

    anybody got any idea plz and can point me to what is going on here..



    THX

  2. #2
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default

    for one u cant have a class and an id in the same tag >.<

  3. #3
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default

    also you messed up
    .resizeme img {
    width:40;
    }
    #resizeme img:hover {
    width:47;
    }

    # = id
    . = class

  4. #4
    Join Date
    Jun 2007
    Posts
    64
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Crazykld69 View Post
    for one u cant have a class and an id in the same tag >.<
    sure i can

    if it's nice code or not, is another question... but still, this is not the problem since i tried different possibilities and it works for other divs not appended by JS... (id+class)

    @ Crazykld69

    that also didnt work...


    and i allready tried every possible way before i made my post...
    id only, class only, on either div or img and both, mixed etc...

    thats why i wrote in my first post "(for testing purpose)"


    but thx anyways for ya posts..



    i still think it has todo with the JS, since its only appended to the body and not really "there"...
    if i check my source-code in the loaded page @ browser, i dont even see the code/tag for this image.. but it is there, just appendeed by JS...

    see what i mean ?!

  5. #5
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default

    oh u have it in a JS?
    then nope i dont think you can do that.
    not sure but move this to the javascript fourm

  6. #6
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello Sir,

    Can you please show me both the files where you are facing problem? If possible, please also tell me your email so that I will send the corrected code to your emai.

    Thank You

  7. #7
    Join Date
    Jun 2007
    Posts
    64
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    the JS Code is the .js from this script -> http://www.dynamicdrive.com/dynamici...tepcarousel.js

    and around this part:

    Code:
    <img src="'+config.defaultbuttons.rightnav[0]+'">
    i tried to manipulate the image with a css so that on hoover the size is changing..


    so i changed it to:

    Code:
    <img id="resizeme" src="'+config.defaultbuttons.rightnav[0]+'">
    with this css:

    Code:
    #resizeme {
    width:40;
    }
    #resizeme:hover {
    width:47;
    }
    but it didnt work... (ignored)


    thx for any hints! ;-)
    Last edited by kobo1d; 05-12-2010 at 09:08 AM.

  8. #8
    Join Date
    May 2010
    Posts
    13
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    An element can certainly have both a class and an id assigned to it. An element can also have multiple classes assigned to it. But an element can only have one ID.

  9. #9
    Join Date
    Jun 2007
    Posts
    64
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    i got this solved by just appending another piece of css-code in the jquery hover function instead of manipulating the external stylesheet...
    everything inside the JS-Code...

    (resolved)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •