admin管理员组

文章数量:1415664

Currently, I'm using following function which works with click event.

$('a.ux-thumb-wrap').click(function(e){
    e.preventDefault();
    href=$(this).attr('href');
    if($(player_container).is(":visible")){
        $(player).tubeplayer('play', href)

    }

    else {
        $(player).tubeplayer({
            width: 853,
            height: 480, 
            allowFullScreen: "true",
            preferredQuality: "large",
            loadSWFObject: false,
            modestbranding: false,
            initialVideo: href,
            autoPlay: true
        });
        player_container.slideDown("slow");
    }

I want to get this result

  • If visitor entered direct url address of some movie (which looks like: domain/?page=youtube#5hly8) into the address bar then fetch the value standing after # symbol and assign to href, do the rest of function

  • During playback, If user clicks on another thumbnail, change the value after # symbol on adress bar to thumbnails href tag, and do the rest of function

I didn't work with hashtags before. Please Help me to modify this function.

Currently, I'm using following function which works with click event.

$('a.ux-thumb-wrap').click(function(e){
    e.preventDefault();
    href=$(this).attr('href');
    if($(player_container).is(":visible")){
        $(player).tubeplayer('play', href)

    }

    else {
        $(player).tubeplayer({
            width: 853,
            height: 480, 
            allowFullScreen: "true",
            preferredQuality: "large",
            loadSWFObject: false,
            modestbranding: false,
            initialVideo: href,
            autoPlay: true
        });
        player_container.slideDown("slow");
    }

I want to get this result

  • If visitor entered direct url address of some movie (which looks like: domain./?page=youtube#5hly8) into the address bar then fetch the value standing after # symbol and assign to href, do the rest of function

  • During playback, If user clicks on another thumbnail, change the value after # symbol on adress bar to thumbnails href tag, and do the rest of function

I didn't work with hashtags before. Please Help me to modify this function.

Share Improve this question edited Jul 11, 2013 at 19:25 Tural Ali asked Dec 17, 2011 at 17:08 Tural AliTural Ali 23.3k18 gold badges81 silver badges133 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

Use the jquery hashchange plugin for a lightweigth approach: http://benalman./projects/jquery-hashchange-plugin/

Even better in the long run is the backbone.js router: http://documentcloud.github./backbone/#Router

本文标签: jqueryJavascript hashtag navigationStack Overflow